Home | Advertising Info57 USERS CURRENTLY ONLINE   
PowerASP
   Site Search Contact Us Thursday, March 13, 2025  


Forms - Populating a check box with info from a database



Below is an example of populating a check box for use with a Boolean (Yes/No) field in your database.

This is just an example.. when doing this for real you would do a query to determine the existing values for all the form fields... for this example we will populate the variable ourselves with either a "True" or "False" value. If the value passed to the save page is not "True" then it is "False" and therefore you update the database accordingly.

<%
FRONTPAGE_ACCESS = "True"
%>

<form method="POST" action="somepage.asp">
<div align="center"><center><table border="0">
<tr>
<td>FRONTPAGE_ACCESS</td>
<td><input type="checkbox" name="FRONTPAGE_ACCESS" value="True"
<% If FRONTPAGE_ACCESS = "True" Then Response.Write (" checked") %>></td>
</tr>
</table>
</center></div>
</form>

And this is what the output would look like if the boolean field was "True".

FRONTPAGE_ACCESS


Below is an example of populating a check box for use with a text field in your database where you have manually inserted text like"Yes" or "No".

This is just an example.. when doing this for real you would do a query to determine the existing values for all the form fields... for this example we will populate the variable ourselves with eithor a "Yes" or "No" value. On the save page if the field passed doesn't = "Yes" then it is the opposite so in this case you assign the database the "No" value on the save page

<%
CGI_ACCESS = "No"
%>

<form method="POST" action="somepage.asp">
<div align="center"><center><table border="0">
<tr>
<td>CGI_ACCESS</td>
<td><input type="checkbox" name="CGI_ACCESS" value="Yes"
<% If CGI_ACCESS = "Yes" Then Response.Write (" checked") %>></td>
</tr>
</table>
</center></div>
</form>

And this is what the output would look like if the text field has the text "No" in it

CGI_ACCESS

   Active Server Pages Rule The World
Contact Us  
All artwork, design & content contained in this site are Copyright © 1998 - 2025 PowerASP.com and Christopher J. Williams
Banner ads ,other site logos, etc are copyright of their respective companies.
STATS Unless otherwise noted - All Rights Reserved.

Active Server Pages asp search engine active server page asp application components tutorial CJWSoft ASPProtect ASPBanner ASPClassifieds www.aspclassifieds.com, www.powerasp.com,www.cjwsoft.com,www.aspphotogallery.com,www.codewanker.com,www.aspprotect.com,www.aspbanner.com