The example in this article describes the method of php to get the array passed from the html form. Share it with everyone for your reference. The details are as follows:
Set the name of each element of the form to the same array object to pass the form value in the form of an array
The html page is as follows:
<form method="post" action="arrayformdata.php"> <label>Tags</label> <input type="text" name="tags[]"/> <input type="text" name="tags[]"/> <input type="text" name="tags[]"/> <input type="text" name="tags[]"/> <input type="text" name="tags[]"/> <input type="submit" value="submit"> </form> </html>
arrayformdata.php page is as follows:
<?php $postedtags = $_POST['tags']; foreach ($postedtags as $tag){ echo "<br />$tag"; } ?>
I hope this article will be helpful to everyone’s PHP programming design.