over 4 textboxes that have the same name. In your action page (code
posted) you only create one record, with a comma delimited list of
values in it. I suppose you want each line in the form to be a record
and create an array from it? Here it comes:
The form:
<table>
<tr>
<td>Issue</td>
<td>Title</td>
<td>Date</td>
<td>Publication</td>
</tr>
<cfloop from="1" to="8" index="i">
<tr>
<td><input type="text" name="Issue_#i#"></td>
<td><input type="text" name="Title_#i#"></td>
<td><input type="text" name="Date_#i#"></td>
<td><input type="text" name="Publication_#i#"></td>
</tr>
</cfloop>
</table>
<input type="hidden" name="Index" value="8">
The action page:
<cfset cassettes_Array=ArrayNew(2)>
<cfloop from="1" to="#form.index#" index="i">
<cfset cassettes_Array[i][1]=form["issue" & i]>
<cfset cassettes_Array[i][2]=form["title" & i]>
<cfset cassettes_Array[i][3]=form["date" & i]>
<cfset cassettes_Array[i][4]=form["publication" & i]>
</cfloop>
<cfoutput>
<cfloop from="1" to="#ArrayLen(cassettes_Array)#" index="i"> Record
#i#<br/> <cfloop from="1" to="#ArrayLen(cassettes_Array[i])#" index="j">
#cassettes_Array[i][j]#<br/> </cfloop> </cfloop> </cfoutput>
The first loop loops the rows, the second loops the columns.
Pascal
> -----Original Message-----
> From: Tim Laureska [mailto:[EMAIL PROTECTED]
> Sent: woensdag 30 juni 2004 11:53
> To: CF-Talk
> Subject: RE: first time array
>
> In experimenting with a 2 dimensional array I used Pascal's
> coding example and have the below code now (which works and
> generates the correct output) but I don't understand the loop
> mechanics.
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

