jasonwisdom Posted April 26, 2015 Share Posted April 26, 2015 Hi everybody! I am building a custom PHP app, and am submitting a form. This form will have between 1 or more textareas, named "textarea1", "textarea2", "textarea200", and so on. I need to read each of these and insert them into a database. How can I script this into the PHP landing page? Is there a way to read all of the values, and names, that are contained in $_POST. Many thanks, Jason Quote Link to comment https://forums.phpfreaks.com/topic/295875-form-post-unknown-number-of-fields-to-retrieve/ Share on other sites More sharing options...
Barand Posted April 26, 2015 Share Posted April 26, 2015 Instead of naming them "textarea1", "textarea2" etc, name them "textarea[]" so they are posted as an array. To process foreach ($_POST['textarea'] as $text) { // process each $text item } Quote Link to comment https://forums.phpfreaks.com/topic/295875-form-post-unknown-number-of-fields-to-retrieve/#findComment-1509979 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.