----- Original Message ----- From: <irinchiang@xxxxxxxxxxxxxxxxx> To: <php-db@xxxxxxxxxxxxx> Cc: <php-general@xxxxxxxxxxxxx> Sent: Wednesday, January 07, 2004 12:07 PM Subject: [PHP] INSERT into mysql from dynamic drop down > > Hi all, > > Right now i would like to INSERT the values from a dynamic drop down > menu into mysql database but encountered some problem here. Values in the drop > down menu are retrieved from DB as follows: > > <SNIP> > > <SELECT NAME="tutor_name" CLASS="textarea"> > <? > > > $sql = mysql_query("SELECT DISTINCT tutor_name FROM tutor"); > while ($row = mysql_fetch_array($sql)) > { > print "<OPTION VALUE=\"$tutor_name\" >" .$row["tutor_name"]. "</option>"; change it to: print "<OPTION VALUE=".$row['tutor_name']." >" .$row["tutor_name"]. "</option>"; hope that helps > } > $result = $db->query($sql); > > ?> > </SELECT> > > </SNIP> > > -------------------------------------------------------------------------- ----- > > echo $_POST["tutor_name"]; > > INSERT statement: > > $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' )"; > > -------------------------------------------------------------------------- ----- > > I am trying to POST the values and then INSERT into DB but was not able to do > so....(all other values eg. class_code, edu_level etc...was able to be > INSERTED into DB but not "tutor_name". So, how do i insert values into DB from > a dynamic drop down and where have i gone wrong???Hope to get some help real > soon.=) > > All help are greatly appreciated. Thanks in advance. > > > Regards, > Irin. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php