Do you understand the request - response process? User requests a page, php buids the page and sends it to the user, user's browser displays the page, users views it and takes some action (follows a link, submits a form) and the whole process repeats.

[EMAIL PROTECTED] wrote:

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')";



Where are the variables coming from?



<?//retrieve data from DB & display in dynamic drop down ?>


<SELECT class="textarea" name="tutor_name" />
                                             |
This is illegal -----------------------------+

<?


$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> ";

Only one option can be selected unless the <select> is multiple


 }
 $result = $db-> query($sql);

?> </select>

<?

while($selected_tutor_name == $tutor_name)
echo $_POST["tutor_name"];

$_POST["tutor_name"] is printed out only if $selected_tutor_name == $tutor_name, in that case the while loop would be infinite however.



?>


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



Reply via email to