How to use PHP & Multiple Hidden Field This tutorial how to using PHP read a variable from input Multiple Hidden Field
ShotDev Focus:
- Using PHP & Multiple Hidden Field
Example
php_multiple_hidden1.php
<html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <form action="php_multiple_hidden2.php" method="post" name="form1"> <input type="hidden" name="hdnSiteName[]" value="ShotDev.Com"> <input type="hidden" name="hdnSiteName[]" value="Hotmail.Com"> <input type="hidden" name="hdnSiteName[]" value="Google.Com"> <input name="btnSubmit" type="submit" value="Submit"> </form> </body> </html>
php_multiple_hidden2.php
<html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <? for($i=0;$i<count($_POST["hdnSiteName"]);$i++) { echo "hdnSiteName $i = ".$_POST["hdnSiteName"][$i]."<br>"; } ?> </body> </html>
Create a php file and save to path root-path/myphp/
Run
http://localhost/myphp/php_multiple_hidden1.php
Screenshot