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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question About CheckBox

Status
Not open for further replies.

Creeder

Programmer
Jul 5, 2000
110
MY
Hi,

A quick question about checkboxes. I have an ASP page that retrieve information into a recordset and certain fields have a value 1 or 0 which is for the checkboxes.

The only way to actually show the check box mark on the page is by

If value = 1 then
response.write &quot;<INPUT type = checkbox Name = chk1 checked &quot;
else
response.write &quot;<INPUT type = checkbox Name = chk1&quot;
end if

Is this the only way to do it?
 
Here's an alternative to writing the entire checkbox string twice.

Code:
<%
k = &quot;&quot;
IF value = 1 THEN
  k = &quot;checked&quot;
END IF
%>
<input <%=k%> type=&quot;checkbox&quot; name=&quot;check1&quot;...>

ToddWW
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top