Problem with INSERT Query

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

 




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.

-- 
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