473,804 Members | 3,446 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Request.Form to retrieve looped form fields

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>Additio nal Group Member <%=x%></legend>
<span id="ag_remove_< %=x%>" style="float: right; padding-right:
8px"><a href="javascrip t:remove_person (<%=x%>)">remov e 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">Tw in</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="instruct ion">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="instruct ion">(if under 18)</span></p>
</fieldset>
<% next %>
<!-- end loop -->
--------------------------------------------------------------------------------

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

David

Sep 20 '07 #1
3 2655
"David" <da*********@sc ene-double.co.ukwro te in message
news:11******** **************@ r29g2000hsg.goo glegroups.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.

--------------------------------------------------------------------------
---------------------------------------------------
>
<!-- begin ASP loop, creating 20 additional group members -->
<% for x=1 to 20 %>
<fieldset id="ag_<%=x%>" >
<legend>Additio nal Group Member <%=x%></legend>
<span id="ag_remove_< %=x%>" style="float: right; padding-right:
8px"><a href="javascrip t:remove_person (<%=x%>)">remov e 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">Tw in</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="instruct ion">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="instruct ion">(if under 18)</span></p>
</fieldset>
<% next %>
<!-- end loop -->
--------------------------------------------------------------------------
------
>
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("A G_fn" & intAG)
arrAG(intAG) = Request.Form("A G_ln" & intAG)
arrAG(intAG) = Request.Form("A G_rt" & intAG)
arrAG(intAG) = Request.Form("A G_i" & intAG)
arrAG(intAG) = Request.Form("A G_age" & intAG)
Next
%>
Sep 20 '07 #2
On 20 Sep, 13:19, "McKirahan" <N...@McKirahan .comwrote:
"David" <davidgor...@sc ene-double.co.ukwro te in message

news:11******** **************@ r29g2000hsg.goo glegroups.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.
--------------------------------------------------------------------------

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


<!-- begin ASP loop, creating 20 additional group members -->
<% for x=1 to 20 %>
<fieldset id="ag_<%=x%>" >
<legend>Additio nal Group Member <%=x%></legend>
<span id="ag_remove_< %=x%>" style="float: right; padding-right:
8px"><a href="javascrip t:remove_person (<%=x%>)">remov e 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">Tw in</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="instruct ion">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="instruct ion">(if under 18)</span></p>
</fieldset>
<% next %>
<!-- end loop -->
--------------------------------------------------------------------------
------
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("A G_fn" & intAG)
arrAG(intAG) = Request.Form("A G_ln" & intAG)
arrAG(intAG) = Request.Form("A G_rt" & intAG)
arrAG(intAG) = Request.Form("A G_i" & intAG)
arrAG(intAG) = Request.Form("A G_age" & intAG)
Next
%>

Sep 20 '07 #3
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"
Sep 20 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1428
by: Tim Chmielewski | last post by:
For an auto-generated form I have the following order of fields: savevalues userid productcode PrintColour1_1 Colour1_1 Quantity_1 " " " " " " " " PrintColour1_5 Colour1_5 Quantity_5
6
2294
by: Agoston Bejo | last post by:
Hi. x1.asp: <form method="post" action="x2.asp"> .... </form> x2.asp: DoSomeAdministration() Response.Redirect "x3.asp?" & Request.Form x3.asp: further processsing of data
6
2426
by: Drew | last post by:
I have been trying to figure out why I am getting this message... I have an application that is 20 different ASP pages that works in sequential order (step1, step2, step3...). After each step the app writes the entered text to a cookie. This feature is so that if there is a problem, we can still retrieve the data. This Bad Request error has something to do with the cookie that is written to, because I can go all the way through the app...
8
393
by: George | last post by:
VS.NET 2002/VB Is it possible to retrieve HTML form variables that are hidden input types using Request.QueryString() and/or Request.Form()? I have tried various ways of using those, but to no avail. My HTML form method is set to POST, and I thought I had read somewhere that this could be done. If it is not possible, is there any way to retrieve HTML form variables into my .aspx page?
9
3169
by: eswanson | last post by:
I have a web page I need to post a file plus some other fields to it. How can I do this from a asp.net page. I know I can send individual fields to the other page, but how do I send a file to the other page, or is there something else like a stream which will be like a file. I am attempting to get a way from writing out a file and then having to give the page that I am posting to the file name. Instead I would like to just from asp.net...
13
3439
by: kev | last post by:
Hi all, I have created a database for equipments. I have a form to register the equipment meaning filling in all the particulars (ID, serial, type, location etc). I have two buttons at the end of the form which is submit and cancel. After i have clicked submit, the information is stored directly into my corresponding database table. My problem here is i need to retrieve back the information submitted to display all the data that the...
0
10586
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10323
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6856
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5658
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3823
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2997
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.