Hello Irin,
Not sure where you problem is but here is what I would check first.
After you open the page that has the drop down list, view the source and
See if the OPTION VALUE= has any value assigned to it. If you are using
IE, on the menu bar click on View - Source.
Second, if that is fine, after you echo the value, you still need to either
1. set the value for $tutor_name in your sql statement - $tutor_name =
$_POST["tutor_name"];
2. Change your sql statement - instead of $tutor_name, say
$sql = "INSERT INTO class (class_code, tutor_name, edu_level, timetable_day,
timetable_time)
VALUES
('$class_code','$_POST["tutor_name"]','$edu_level','$timetable_day','$timeta
ble_time')";
You will have to play with the " and ' to get this right..
I would suggest option 1
Hope this helps..
Aleks
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 07, 2004 1:37 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: [PHP-DB] 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>"; } $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
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php