Hi,
This is probably very simple but for some reason I can't get this loop to work properly. I am looping through a column in my database. If a field is found in the column a checked box is displayed along with the name of the field. If it is not found I want to display an unchecked box.
I've tried a single outer loop using if statments as well but it prints out too many checkboxes...
Here is the code:
<table width="490" border = "1">
<tr>
<td width="38">
<% Do while not rsCategories.EOF
if rsCategories("Category") = "Football" then %>
<INPUT TYPE="CHECKBOX" NAME="Football" value="Football" checked = "true"></td>
<% else %>
<input TYPE="CHECKBOX" NAME="Football" VALUE="Football"></td>
<%end if
rsCategories.moveNext()
loop %>
<td width="130">Football</td>
</tr>
<tr>
<td width="38">
<% rsCategories.moveFirst()
Do while not rsCategories.EOF
if rsCategories("Category") = "Hurling" then %>
<INPUT TYPE="CHECKBOX" NAME="Hurling" value = "Hurling" checked = "true"></td>
<% else %>
<INPUT TYPE="CHECKBOX" NAME="Hurling" value = "Hurling"></td>
<% end if
rsCategories.moveNext()
loop %>
<td width="130">Hurling</td>
</tr>
...same procedure continues down to the end of the table
I'd appreciate if anyone could show me the light!
Thanks
Ciarrai
This is probably very simple but for some reason I can't get this loop to work properly. I am looping through a column in my database. If a field is found in the column a checked box is displayed along with the name of the field. If it is not found I want to display an unchecked box.
I've tried a single outer loop using if statments as well but it prints out too many checkboxes...
Here is the code:
<table width="490" border = "1">
<tr>
<td width="38">
<% Do while not rsCategories.EOF
if rsCategories("Category") = "Football" then %>
<INPUT TYPE="CHECKBOX" NAME="Football" value="Football" checked = "true"></td>
<% else %>
<input TYPE="CHECKBOX" NAME="Football" VALUE="Football"></td>
<%end if
rsCategories.moveNext()
loop %>
<td width="130">Football</td>
</tr>
<tr>
<td width="38">
<% rsCategories.moveFirst()
Do while not rsCategories.EOF
if rsCategories("Category") = "Hurling" then %>
<INPUT TYPE="CHECKBOX" NAME="Hurling" value = "Hurling" checked = "true"></td>
<% else %>
<INPUT TYPE="CHECKBOX" NAME="Hurling" value = "Hurling"></td>
<% end if
rsCategories.moveNext()
loop %>
<td width="130">Hurling</td>
</tr>
...same procedure continues down to the end of the table
I'd appreciate if anyone could show me the light!
Thanks
Ciarrai