How can I implement user input array in PHP

How can I implement user input array in PHP

GET and POST requests will be translated to arrays.

1 Like

If you want to receive an array you should provide multiple input fields to the user.
These fields should have the same name, with square brackets:

<input type="text" name="myfield[]">
<input type="text" name="myfield[]">
<input type="text" name="myfield[]">

On the server side you’ll receive an array:

$_POST['myfield'][0] //get value of the first input
3 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.