Home > Backend Development > PHP Tutorial > php method to get the array passed from the html form, phphtml form array_PHP tutorial

php method to get the array passed from the html form, phphtml form array_PHP tutorial

WBOY
Release: 2016-07-13 10:01:53
Original
1290 people have browsed it

php method to get the array passed from the html form, phphtml form array

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>
Copy after login

arrayformdata.php page is as follows:

<&#63;php
$postedtags = $_POST['tags'];
foreach ($postedtags as $tag){
  echo "<br />$tag";
}
&#63;>
Copy after login

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/970996.htmlTechArticlephp method to get the array passed from the html form, phphtml form array This article tells the example of php getting the array passed from the html form method. Share it with everyone for your reference. The details are as follows:...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template