Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   MySQL (https://www.askmehelpdesk.com/forumdisplay.php?f=442)
-   -   How to retain selected value from a dropdown list in a db? (https://www.askmehelpdesk.com/showthread.php?t=561874)

  • Mar 13, 2011, 10:51 AM
    jeri20
    how to retain selected value from a dropdown list in a db?
    how do I save the selected value from the drop down list below into a mysql database? (the drop down list fetchs records from a table in the database)

    <?php
    print "Select Hairdresser: ";
    $query="SELECT Staff_Name, Staff_Surname,id FROM staff ORDER BY Staff_Surname ASC";
    $result = mysql_query ($query);
    echo "<select name=Staff_Name, Staff_Surname value=''>Staff</option>";
    while($nt=mysql_fetch_array($result)){
    echo "<option value=$nt[id]>$nt[Staff_Name] $nt[Staff_Surname]</option>";}
    echo "</select>";
    ?>

  • All times are GMT -7. The time now is 06:52 PM.