Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.