INSERT into mysql from dynamic drop down

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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>";
 }
$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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux