Request.Form to retrieve looped form fields

D

David

Hi,

I have some code in my form as follows, to display 1 to 20 additional
sets of fields to enter guest information.
I am not sure how to retrieve these guests info so that I can post the
info on an email such as:

Additional Guest 1
First Name =
Last Name =

Additional Guest 2
First Name =
Last Name =

i.e. The 'First Name' for guest 1 is > name="AG_fn<%=x%>"
The code loops through depending how many sets of fields were
completed.

-----------------------------------------------------------------------------------------------------------------------------

<!-- begin ASP loop, creating 20 additional group members -->
<% for x=1 to 20 %>
<fieldset id="ag_<%=x%>">
<legend>Additional Group Member <%=x%></legend>
<span id="ag_remove_<%=x%>" style="float: right; padding-right:
8px"><a href="javascript:remove_person(<%=x%>)">remove this person</
a></span>
<p><label for="AG_fn<%=x%>">First name:</label>
<input class="inp" name="AG_fn<%=x%>" id="AG_fn<%=x%>"
type="text" /></p>

<p><label for="AG_ln<%=x%>">Last name:</label>
<input class="inp" name="AG_ln<%=x%>" id="AG_ln<%=x%>"
type="text" /></p>

<p><label for="AG_rt<%=x%>">Room Type:</label>
<select name="AG_rt<%=x%>" id="AG_rt<%=x%>">
<option value="Single">Single</option>
<option value="Double">Double</option>
<option value="Twin">Twin</option>
</select></p>

<p><label for="AG_i<%=x%>">Insurance?</label>
<select name="AG_i<%=x%>" id="AG_i<%=x%>">
<option value="No">No</option>
<option value="Yes">Yes</option>
</select>
<span class="instruction">Do you require travel insurance?</span></
p>

<p><label for="AG_age<%=x%>">Age:</label>
<input class="inp small" name="AG_age<%=x%>" id="AG_age<%=x
%>" type="text" />
<span class="instruction">(if under 18)</span></p>
</fieldset>
<% next %>
<!-- end loop -->


--------------------------------------------------------------------------------

How would I retrieve each additional guests info and store it into
variables ? Thanks

David
 
D

David

Are you looking for something like this?
Thanks,

I get this error though !

Microsoft VBScript compilation error '800a0402'

Expected integer constant

/Form_Ski/Booking_thanks.asp, line 61

Dim arrAG(cAG)
----------^
 
B

Bob Barrows [MVP]

David said:
Expected integer constant

/Form_Ski/Booking_thanks.asp, line 61

Dim arrAG(cAG)
----------^

A variable cannot be used here. In vbscript one must first declare a dynamic
array (note the empty parentheses):

Dim arrAG()

.... and then redim it:

ReDim arrAG(cAG)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top