This article mainly introduces the method of PHP to obtain the array passed from the HTML form. The example analyzes the skills of PHP to operate the form elements. It is of great practical value. Friends who need it can refer to it.
The examples in this article describe PHP get method of passing array from 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. You can also 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 The .php page is as follows:
<?php $postedtags = $_POST['tags']; foreach ($postedtags as $tag){ echo "<br />$tag"; } ?>
Summary: The above is the entire content of this article, I hope it will be helpful to everyone's study.
Related recommendations:
PHP encryption and decryption functions generate encryption and decryption strings
The database in PHP implements more secure permanent login and recording Live my function
PHP is based on Ajax to realize non-refresh login and exit
The above is the detailed content of php how to get array passed from html form. For more information, please follow other related articles on the PHP Chinese website!