Problem with INSERT Query

From: Date: Tue, 30 Dec 2003 07:09:31 +0000
Subject: Problem with INSERT Query
Groups: php.db php.general 
Request: Send a blank email to php-db+get-32218@lists.php.net to get a copy of this message
Hi all: Well, when i bring out the page with the drop down list it was able to display all tutors' names from "tutor_name" column. Anyway here's a review of my code (snip) again before i continue: ------------------------------------------------------------------------------- <snip> $sql = "INSERT INTO class (class_code, tutor_name, edu_level, timetable_day, timetable_time) VALUES ('$class_code','$tutor_name','$edu_level','$timetable_day','$timetable_time')"; <?//retrieve data from DB & display in dynamic drop down ?> <SELECT class="textarea" name="tutor_name" /> <? $sql = mysql_query("SELECT DISTINCT tutor_name FROM tutor "); while ($row = mysql_fetch_array($sql)) { print "<OPTION VALUE=\"$tutor_name\" SELECTED> " .$row ["tutor_name"]. "</option> "; } $result = $db-> query($sql); ?> </select> <? while($selected_tutor_name == $tutor_name) echo $_POST["tutor_name"]; ?> </snip> ------------------------------------------------------------------------------- so when i submit the form, i am suppose to echo the values i have entered into the field and then INSERT the values into DB (Queries stated above). However i was able to echo all other values eg. class_code, edu_level, etc...but not "tutor_name"....same thing happen when i do an INSERT, all other values are inserted into DB but not $tutor_name....why is this so???Really need some help here...Anyway i have already specify a name to be reference : <SELECT class="textarea" name="tutor_name" > and then I also did an echo of "tutor_name" being selected: while($selected_tutor_name == $tutor_name) echo $_POST["tutor_name"]; All help are greatly appreciated =) Irin.

« previous php.db (#32218) next »