Click to See Complete Forum and Search --> : For Next in a form


bloke
08-20-2003, 04:23 AM
Quick one, hopefully, folks

Just me bein a bit tick as usual....

I have this bit in a form....

<%For x = 1 to 17
strItemField = "Item" & (x)
strQuantityField = "Quantity" & (x)
strUnitField = "Unit" & (x)
strDescField = "Description" & (x)
strUnitRateField = "UnitRate" & (x)
strTotalField = "Total" & (x)
%>
<tr class="contentdetailnew">
<td><input type="" name="<%=strItemField%>" size="10" maxlength="150" class="contentdetailnew"></td>
<td><input type="text" name="<%=strQuantityField%>" size="10" maxlength="20" class="contentdetailnew"></td>
<td><input type="text" name="<%=strUnitField%>" size="10" maxlength="20" class="contentdetailnew"></td>
<td><input type="text" name="<%=strDescField%>" size="25" maxlength="150" class="contentdetailnew"></td>
<td>&pound;&nbsp;<input type="text" name="<%=strUnitRateField%>" size="10" maxlength="20" class="contentdetailnew"></td>
<td>&pound;&nbsp;<input type="text" name="<%=strTotalField%>" size="10" maxlength="20" class="contentdetailnew" onBlur="addVal(this);"></td>
</tr>
<%Next%>

Which generates 18 instances of these fields, all numbered 1 - 18.

Problem is I want to pull them out on the receiving page using a similar loop if possible. Kind of like this:

For x = 1 to 18
stritem & x = valNull(request.form("item(x)"))
...etc...
Next

but can't quite put my finger on the correct syntax (if it's possible)

Help, as always, greatly appreciated.

bloke
08-26-2003, 10:02 AM
If this helps,

Request.Form("item" & (x)) seems to be ok, it's the first bit that I need:

stritem&cstr(x) = Request.Form("item" & (x))

or

stritem(x) = Request.Form("item" & (x))

or

stritem&x = Request.Form("item" & (x))

or

whatever

in short, I need:

stritem1 = request.form("item1")

I know I've made this a tad long winded but my minds gone and I'm rambling......

Cheers

bloke
08-28-2003, 06:14 AM
Used arrays in the end, if anyone cares.