JC99 Posted July 24, 2009 Share Posted July 24, 2009 Hello, I would like to take the values of a textfield in a form and put it into an array, then be able to display the values in that array. How would I do that. Here is my form... <form action="index.php>" method="post"> <table> <tr> <td>Option1</td> <td><input type="text" name="option[]" /></td> </tr> <tr> <td>Option2</td> <td><input type="text" name="option[]" /></td> </tr> <tr> <td></td> <td><input value=submit" name="submit" type="submit" /></td> </tr> </table> </table></form> Link to comment https://forums.phpfreaks.com/topic/167218-solved-a-form-and-an-array/ Share on other sites More sharing options...
JC99 Posted July 24, 2009 Author Share Posted July 24, 2009 On index.php (Where the form redirects me too) I added the following... foreach ($_POST['option'] as $value) { echo "Value: $value<br />\n"; } ...and everything is working. Link to comment https://forums.phpfreaks.com/topic/167218-solved-a-form-and-an-array/#findComment-881723 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.