| 
 Posted by Kimmo Laine on 10/16/06 07:36 
"= poster =" <nomail@nomail.spam> wrote in message  
news:45333112$0$1117$ba620e4c@news.skynet.be... 
> Hi all , 
> 
> I have a script which let the user choose between four days : 
> 
> Day: <select name=\"day\" value=\"$day\"> 
> <option value=\"01\">1</option> 
> <option value=\"02\">2</option> 
> <option value=\"03\">3</option> 
> <option value=\"04\">4</option> 
> </select> 
> 
> The selected number is saved in mysql database. 
> I have also a script which alows the user to edit their choises. 
> The problem is that I don't know how to set the value from the database  
> into 
> the select thingy. 
> 
> I know how to handel this with an: 
> <input type="text" name="title" value=$somvar > 
> 
> But how can I do this with the select thingy ? 
 
 
Just add selected="selected" to the option you want selected. 
 
Example: 
 
<select name=\"day\" value=\"$day\"> 
 <option value=\"01\">1</option> 
 <option value=\"02\" selected=\"selected\">2</option> 
 <option value=\"03\">3</option> 
 <option value=\"04\">4</option> 
</select> 
 
this sets 02 selected. 
 
--  
"Ohjelmoija  on  organismi  joka  muuttaa  kofeiinia  koodiksi" - lpk 
http://outolempi.net/ahdistus/ - Satunnaisesti pδivittyvδ nettisarjis 
spam@outolempi.net | rot13(xvzzb@bhgbyrzcv.arg)
 
  
Navigation:
[Reply to this message] 
 |