View Full Version : Edit Selection

01-30-2007, 06:54 PM
I have a form that includes a dropdown menu that allows a user to pick and then is sent to mysql db table. I would like to be able to let the user go back and edit the info. I can echo back the choice the user made but how do you let the user choose again from the dropdown menu. Hope that makes sense>


01-30-2007, 07:47 PM
You would probably want to create a separate edit page/link for the user. Then you would just query based on whatever criteria you set and use the 'UPDATE' mysql syntax.

Good luck!

01-30-2007, 08:53 PM
he's not talking about the sql syntax, he means simple selecting the right value from the drop list.

try something like that,, asuming that you list is dynamic:

echo "<select name='' id=''>";
while ($row = mysql_fetch_assoc($result)) {
if($numOriginalSelection == $row['id']){
echo "<option value='" . $row['id'] . "' SELECTED>" . $row['name'] . "</option>";
} else {
echo "<option value='" . $row['id'] . "'>" . $row['name'] . "</option>";
echo "</select>";

so, "$numOriginalSelection" would be the original selection pulled from the data base.