PDA

View Full Version : Building a Dynamic Checkbox


admin
05-30-2003, 01:40 PM
You have a form with checkboxes that you want to populate dynamically. Here's one way...

orderStatus = Request.Form("status")

<form action="process.asp" action="post">
<input type="checkbox" name="status" value=1 <% If orderStatus = "1" Then Response.Write "CHECKED" %>>Gizmo<br>
<input type="checkbox" name="status" value=2 <% If orderStatus = "2" Then Response.Write "CHECKED" %>>Gadget<br>
<input type="checkbox" name="status" value=3 <% If orderStatus = "3" Then Response.Write "CHECKED" %>>Gimp<br>
</form>

The value of orderStatus determines which checkbox was checked.