I know this can be done, just don't know where to start.
I am creating a site and have a multiple select box in a form
I am going to pass to this form data from a database to be displayed as values. I can do this no problem. But one thing that is frustrating me is I don't know how to pre select the options of the multiple select box based on the results from the database.
<select name="country" multiple="multiple"> <option>United Kingdom</option> <option>United States</option> <option>France</option> <option>Germany</option> <option>Spain</option> <option>Italy</option> </select>
Lets say that this is the returned data from the country database table But the user can choose to select which countries they want this form applied to so they select UK, USA and France using their mouse. Their submission then gets stored in another table in the database in a field called country.
So when they edit their submission it gathers their response data from the response table and builds the form values based on their submission
so for instance their name field will go from
<input type="text" name="name" value="" />
<input type="text" name="name" value="My Name" />
How do I get the country multiple select box to highlight or pre select the option values that match the data held in the submission country field?
Hope this makes sense