On Tue, March 29, 2005 3:06 am, Colin Ross said: > In edit_schedule.phps: > > if (isset($_POST['add_available'])){ > $year = $_POST['year']; > $year = $year['NULL']; > $month = $_POST['month']; > $month = $month['NULL']; > $day = $_POST['day']; > $day = $day['NULL']; > $time = $_POST['time']; > $time = $time['NULL']; > ... > } > after this is done.. > $year, $month, $day, and $time should all be arrays with a single > 'null' (not the keyword null though) item with no value. ie. > array(NULL=>); No. > what ARE you trying to do, you are making the POST vars global: > $day = $_POST['day']; > OK. (why do you even need to do this? whatever, matter of taste i guess..) > But then you over write their values, making them arrays with that > single element 'NULL' > $day = $day['NULL']; > Not seeing the logic here... All of those $_POST elements *ARE* arrays because the HTML has NAME="year[...]" For pre-existing slots, they have a valid slot_id in the array index. For the one NEW item to be inserted, I used the key [NULL] which in HTTP turns into 'NULL' as an index into the array. In other words, if there were 3 pre-exsiting slots, and the user fills in the "NEW" date to add, and I did: var_dump($_POST['date']); I'd get something not unlike: array('1'=>'2005-04-01', '2'=>'2005-04-04', '3'=>'2005-04-05', 'NULL'=>'2005-04-06'); Thus, $year = $_POST['year']; gets me the whole array, and then $year = $year['NULL'] gets me the NEW year they are asking me to insert. I dunno why this seemed so confusing, but it makes perfect sense to me. [shrug] > Overall, and not to mean offence, but your code is kinda sloppy and > has syntax and logic errors. > > <?="$slot", ($taken ? ' <FONT COLOR="RED">TAKEN</FONT>' : '')?> > SHOULD be erroring up (if you have errors turned on, please say you do > for development) > try: > <?php echo $slot; if ($taken) echo '<FONT COLOR="RED">TAKEN</FONT>'; ?> > > and btw, the short conditional syntax is: > (condition) ? true : false; > // ie. (note the empty string... you gotta have SOMETHING there > [right?i think so] > echo ($taken) ? '<FONT COLOR="RED">TAKEN</FONT>' : '' ; Yes, <?= is not portable to a site that doesn't have short_tags ON. No, I don't care, since I'll NEVER move this code to another host/server. Note that echo takes multiple arguments. Note that the parens I use are to group the second argument to the echo statement. The second argument being a valid ternary operater statement. So there are no error messages because it *IS* syntactically (and logically) valid. The FIRST thing I do on any new server/site is crank up E_ALL for the errors. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php