Can somebody please help me by showing me how to retrieve values from variable numbers of script created HTML objects with an ASP script.
As an example, the following script creates a number of checkboxes and when the submit button is presses I wish to retrieve the status of each checkbox in the result.asp script.
It is important to remember the number of checkboxes can vary.
Thanks in Advance
Tony
<%
for i=1 to 10
%>
name=checkbox<%=i%>>
<%
next
%>
Comments
: As an example, the following script creates a number of checkboxes and when the submit button is presses I wish to retrieve the status of each checkbox in the result.asp script.
: It is important to remember the number of checkboxes can vary.
:
: Thanks in Advance
: Tony
:
:
:
:
:
:
:
:
: <%
: for i=1 to 10
: %>
: name=checkbox<%=i%>>
: <%
: next
: %>
:
:
:
:
:
:
see keep in mind some points when dealing with check boxes
1.if the check box you make is not checked
the check box as an object will not be carried to the asp page
that is neither its name nor its value
2. specify the value of the check box in the html page this way
>
ok if these two points are clear then
this is how you recieve them in
in the results.asp page
dim checkbox(10) ' this is the array that i will fill up
if request("submit") <> "" then
for each variable in Request.Form
checkbox(1,i)= trim(variable)
checkbox(2,i)= trim(Request.Form(variable))
i = i + 1
next
end if
' now this way you will get a two dimensional array containing the names of the checkbox in the first row of the array and their values in the second row
so to access the values of the check box
do it this way
firstcheckboxname = checkbox(1,0)
firstcheckboxvalue = checkbox(2,0)
and so forth
ok