-
Hi there!
If I use a checkbox in a asp page, displaying the value from the database and updating the value of the checkbox to the database seems to be a problem. At present I am using another hidden input to pass the value. I hope someother easy method may be there!
Can u help me?
Thanx in advance!
-
Code:
<html>
<head>
<title>Checkbox Test</title>
</head>
<body>
<p>
<%
if request("chkTest") = "on" then
Response.Write "Checkbox is checked.<br>Write ""true"" to database."
else
Response.Write "Checkbox is not checked.<br>Write ""false"" to database."
end if
%>
</p>
<form action="<%=Request.ServerVariables("SCRIPT_NAME") %>" method="post">
<label for="test"><input type="checkbox" name="chkTest" <% if request("chkTest") = "on" then Response.Write "checked" %> id="test"> Text</label><br>
<input type="submit" value="Test it!">
</form>
</body>
</html>