Hi Everyone,
I have a form that has fields to it. I want the user to be able to enter up to 15 entries. I used a loop to have the additional rows display...
here is the form code.
<tr>
<td width="48"> </td>
<td width="48">Date</td>
<td width="1"> </td>
<td width="139">Customer</td>
<td width="1"> </td>
<td width="180">Destination</td>
<td width="8"> </td>
<td width="84">Start Mileage</td>
<td width="6"> </td>
<td width="85">End Mileage </td>
<td width="3"> </td>
<td width="100">NY Thruway </td>
<td width="3"> </td>
<td width="62">State</td>
<td width="1"> </td>
<td width="62">Total</td>
</tr>
<tr>
<td><cfloop from = "1" to = "15" index = "tripentry">
<input name = "#tripentry#" type = "hidden" size="5" maxlength="5">
</cfloop></td>
<td><cfloop from = "1" to = "15" index = "tripdate">
<input name = "#tripdate#" type = "text" size="15" maxlength="15">
</cfloop></td>
<td> </td>
<td><cfloop from = "1" to = "15" index = "tripcust">
<input type = "text" name = "#tripcust#"></cfloop></td>
<td> </td>
<td><cfloop from = "1" to = "15" index = "tripdest">
<input type = "text" name = "#tripdest#"></cfloop></td>
<td> </td>
<td><cfloop from = "1" to = "15" index = "tripstart">
<input name = "#tripstart#" type = "text" size="10" maxlength="10">
</cfloop></td>
<td> </td>
<td><cfloop from = "1" to = "15" index = "tripend">
<input name = "#tripend#" type = "text" size="10" maxlength="10">
</cfloop></td>
<td> </td>
<td><cfloop from = "1" to = "15" index = "tripthru">
<input name = "#tripthur#" type = "text" size="5" maxlength="5">
</cfloop></td>
<td> </td>
<td><cfloop from = "1" to = "15" index = "tripstate">
<input name = "#tripstate#" type = "text" size="5" maxlength="5">
</cfloop></td>
<td> </td>
<td><cfloop from = "1" to = "15" index = "triptotal">
<input name = "#triptotal#" type = "text" size="5" maxlength="5">
</cfloop></td>
</tr>
Now I am stuck. I am trying to learn the cfloop so please be kind. I am reading my book and trying out the code on test pages.
The next piece I would want to do is just cfloop through on my action page to insert those records. So when I go to write my insert code I get confused. Do I just loop a formfield?
Any help is so greatly appreciated.
John
I have a form that has fields to it. I want the user to be able to enter up to 15 entries. I used a loop to have the additional rows display...
here is the form code.
<tr>
<td width="48"> </td>
<td width="48">Date</td>
<td width="1"> </td>
<td width="139">Customer</td>
<td width="1"> </td>
<td width="180">Destination</td>
<td width="8"> </td>
<td width="84">Start Mileage</td>
<td width="6"> </td>
<td width="85">End Mileage </td>
<td width="3"> </td>
<td width="100">NY Thruway </td>
<td width="3"> </td>
<td width="62">State</td>
<td width="1"> </td>
<td width="62">Total</td>
</tr>
<tr>
<td><cfloop from = "1" to = "15" index = "tripentry">
<input name = "#tripentry#" type = "hidden" size="5" maxlength="5">
</cfloop></td>
<td><cfloop from = "1" to = "15" index = "tripdate">
<input name = "#tripdate#" type = "text" size="15" maxlength="15">
</cfloop></td>
<td> </td>
<td><cfloop from = "1" to = "15" index = "tripcust">
<input type = "text" name = "#tripcust#"></cfloop></td>
<td> </td>
<td><cfloop from = "1" to = "15" index = "tripdest">
<input type = "text" name = "#tripdest#"></cfloop></td>
<td> </td>
<td><cfloop from = "1" to = "15" index = "tripstart">
<input name = "#tripstart#" type = "text" size="10" maxlength="10">
</cfloop></td>
<td> </td>
<td><cfloop from = "1" to = "15" index = "tripend">
<input name = "#tripend#" type = "text" size="10" maxlength="10">
</cfloop></td>
<td> </td>
<td><cfloop from = "1" to = "15" index = "tripthru">
<input name = "#tripthur#" type = "text" size="5" maxlength="5">
</cfloop></td>
<td> </td>
<td><cfloop from = "1" to = "15" index = "tripstate">
<input name = "#tripstate#" type = "text" size="5" maxlength="5">
</cfloop></td>
<td> </td>
<td><cfloop from = "1" to = "15" index = "triptotal">
<input name = "#triptotal#" type = "text" size="5" maxlength="5">
</cfloop></td>
</tr>
Now I am stuck. I am trying to learn the cfloop so please be kind. I am reading my book and trying out the code on test pages.
The next piece I would want to do is just cfloop through on my action page to insert those records. So when I go to write my insert code I get confused. Do I just loop a formfield?
Any help is so greatly appreciated.
John