Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populating Radio buttons

Status
Not open for further replies.

Albano

Instructor
Dec 11, 2000
221
PT
Hello,
Whow can i populate radio buttons with data from a database.

Thanks,

Albano
 
when you build the HTML line if you want the value "on" then put the word CHECKED in the string

<INPUT TYPE=&quot;RADIO&quot; CHECKED>
 
This is how would tell it to &quot;checked&quot; the radio if a value in the db is true..

Code:
Do while not rs.eof

'# check the value in db to see if this radio needs checking...
If rs(&quot;radio_checked&quot;) = &quot;y&quot; then strChecked = &quot; Checked&quot;

'# Write out the radio, and the title of the radio...
Response.Write(<input type='radio' name='radio' value='&quot; & rs(&quot;record_id&quot;) & &quot;'&quot; & strChecked & &quot;>&quot; & rs(&quot;record_title&quot;) & <br>)

rs.movenext
loop
www.vzio.com
ASP WEB DEVELOPMENT



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top