Jump to content

Aray from textfeilds.


the_oliver

Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.