the_oliver Posted May 28, 2007 Share Posted May 28, 2007 Hello, Im trying to build something where a user can select from a dropdown menu a number. After the form has been submited another form appears, with the same number of textareas as the number they chose in the dropdown menu. I can work that bit out, but the bit that im unsure of is how when they submit the new form, i can place each of the entries into an aray to be transfered into a database? Does that make sence. Thanks. Link to comment https://forums.phpfreaks.com/topic/53287-aray-from-textfeilds/ Share on other sites More sharing options...
wildteen88 Posted May 28, 2007 Share Posted May 28, 2007 I would give the generated textareas the same name and end the name with square brackets eg: myTxtAreaName[] That will submit the textareas in an array called myTxtAreaName then us $_POST['txtAreaName'][0] to get the first textarea, $_POST['txtAreaName'][1] for the second etc. Remember arrays start at zero and not 1. Link to comment https://forums.phpfreaks.com/topic/53287-aray-from-textfeilds/#findComment-263335 Share on other sites More sharing options...
gabeg Posted May 28, 2007 Share Posted May 28, 2007 That will submit the textareas in an array called myTxtAreaName then us $_POST['txtAreaName'][0] to get the first textarea, $_POST['txtAreaName'][1] for the second etc. Remember arrays start at zero and not 1. Alternatively, you can run a for loop on the myTxtAreaName. This will help if you don't know the number of textareas that are going to be used Link to comment https://forums.phpfreaks.com/topic/53287-aray-from-textfeilds/#findComment-263372 Share on other sites More sharing options...
Barand Posted May 28, 2007 Share Posted May 28, 2007 I think you meant a foreach() loop Link to comment https://forums.phpfreaks.com/topic/53287-aray-from-textfeilds/#findComment-263497 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.