Jalz Posted August 2, 2009 Share Posted August 2, 2009 Hi Guys, I have the following scenario. I have a form on html page, in which I'm posting various input/hidden fields to a response page which then alters the data within my database, which is great. The problem I have though is, I have a dynamic table within my form which could have upto 6 rows with input fields which contain the samefieldnames called Address1, Address2, Country, Postcode. The thing is, when I post my data to the response page, I only get the data of the 'last' row in the table, so in otherwords I get the last Address1, Address2,, Country and Postcode fields. Is it possible someone can advise me on how I can post all the data (A member may have 4 addresses) into an array as I can work out how to extract that data from the array in my response page. Many Thanks for any as always. Sample data below: <table width="200" border="0"> <tr> <td>Address1</td> <td>Country</td> <td>Postcode</td> </tr> <tr> <td><input name="Address1" type="text" value="22 Bishop Crewe" id="Address1"></td> <td><input name="Country" type="text" value="Holland" id="Country"></td> <td><input name="Postcode" type="text" value="HH" id="Postcode"></td> </tr> <tr> <td><input name="Address1" type="text" value="Cottesbrooke Park" id="Address1"></td> <td><input name="Country" type="text" value="Scotland" id="Country"></td> <td><input name="Postcode" type="text" value="SE4 1NR" id="Postcode"></td> </tr> <tr> <td><input name="Address1" type="text" value="Trueway" id="Address1"></td> <td><input name="Country" type="text" value="England" id="Country"></td> <td><input name="Postcode" type="text" value="NN11 8YL" id="Postcode"></td> </tr> </table> Quote Link to comment Share on other sites More sharing options...
Psycho Posted August 3, 2009 Share Posted August 3, 2009 Just name your fileds like this: <input name="Address1[]" type="text" value="22 Bishop Crewe" id="Address1_1"> Notice that I added a "_1" to the ID value. You will need to increase those by one or some other method as you can't have two objects on the page with the same ID, but you can add [] to the field names to have the values returned as an array Quote Link to comment Share on other sites More sharing options...
Jalz Posted August 3, 2009 Author Share Posted August 3, 2009 Thankyou mjdamato, That has got me sorted , now I can concentrate on my response page. Jalz Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.