There must be an easy solution to this one....

Hi, i have made a form that gets users info and puts them into a database. I have then made a modify details page which allows users to modify their details. On the “Modify Details” page i have used this code to prompt the information from the database so user doesnt have to retype everything.

'>

the problem is, i am using some DROP DOWN LISTS (see code below) . How do i make the correct value in the drop down list show up? at the moment it defaults to the first value in the list which is Argentina.

i know this is probably a really easy solution but i have tried searching with no solution to my avail

thanks for your help

Primarily providing TRE in* Argentina Australia Austria Belgium Brazil Canada Chile China Columbia Denmark England Finland France Germany Italy Japan New Zealand Norway Poland Portugal Singapore Slovenia South Africa Spain Sweden Switzerland UAE US UK

Hi ,

On top line of the options add

<?php echo $var ;?>

Replace the $var with rhe variable that holds the database data

If you want to keep them in the same order, you would have to check each option and add “SELECTED” to the end of the line.

$var = “one of the countries”…

>Argentina

But, you would have to do that for each line in the SELECT. Hopefully, you are creating this drop-down from your database, so this would be a small fix. Just have to remember the old selection and set the one that is needed in your while loop when creating the drop-downs. Hope that made sense… Good luck.

Sponsor our Newsletter | Privacy Policy | Terms of Service