Request.Form to retrieve looped form fields

Request.Form to retrieve looped form fields

am 20.09.2007 12:54:47 von davidgordon

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.

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


<% for x=1 to 20 %>


Additional Group Member <%=x%>
remove this person a>


type="text" />




type="text" />








Do you require travel insurance? p>



(if under 18)



<% next %>



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

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

David

Re: Request.Form to retrieve looped form fields

am 20.09.2007 14:19:56 von McKirahan

"David" wrote in message
news:1190285687.622769.198210@r29g2000hsg.googlegroups.com.. .
> 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.
>
> ------------------------------------------------------------ --------------
---------------------------------------------------
>
>
> <% for x=1 to 20 %>
>


> Additional Group Member <%=x%>
>
remove this person > a>
>


> > type="text" />


>
>


> > type="text" />


>
>


>


>
>


>
> Do you require travel insurance? > p>
>
>


>
> (if under 18)


>

> <% next %>
>
>
>
> ------------------------------------------------------------ --------------
------
>
> How would I retrieve each additional guests info and store it into
> variables ? Thanks
>
> David
>

Are you looking for something like this?

<%
Const cAG = 20
Dim arrAG(cAG)
Dim intAG

For intAG = 1 to cAG
arrAG(intAG) = Request.Form("AG_fn" & intAG)
arrAG(intAG) = Request.Form("AG_ln" & intAG)
arrAG(intAG) = Request.Form("AG_rt" & intAG)
arrAG(intAG) = Request.Form("AG_i" & intAG)
arrAG(intAG) = Request.Form("AG_age" & intAG)
Next
%>

Re: Request.Form to retrieve looped form fields

am 20.09.2007 15:20:29 von davidgordon

On 20 Sep, 13:19, "McKirahan" wrote:
> "David" wrote in message
>
> news:1190285687.622769.198210@r29g2000hsg.googlegroups.com.. .
>
>
>
>
>
> > 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.
>
> > ------------------------------------------------------------ --------------
>
> ---------------------------------------------------
>
>
>
>
>
> >
> > <% for x=1 to 20 %>
> >


> > Additional Group Member <%=x%>
> >
remove this person > > a>
> >


> > > > type="text" />


>
> >


> > > > type="text" />


>
> >


> >


>
> >


> >
> > Do you require travel insurance? > > p>
>
> >


> >
> > (if under 18)


> >

> > <% next %>
> >
>
> > ------------------------------------------------------------ --------------
> ------
>
> > How would I retrieve each additional guests info and store it into
> > variables ? Thanks
>
> > 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)
----------^


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




> <%
> Const cAG = 20
> Dim arrAG(cAG)
> Dim intAG
>
> For intAG = 1 to cAG
> arrAG(intAG) = Request.Form("AG_fn" & intAG)
> arrAG(intAG) = Request.Form("AG_ln" & intAG)
> arrAG(intAG) = Request.Form("AG_rt" & intAG)
> arrAG(intAG) = Request.Form("AG_i" & intAG)
> arrAG(intAG) = Request.Form("AG_age" & intAG)
> Next
> %>

Re: Request.Form to retrieve looped form fields

am 20.09.2007 15:33:53 von reb01501

David wrote:
> 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)


--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"