How to use PHP & ListMenu/Select Menu This tutorial how to using PHP read a variable from ListMenu/Select Menu
ShotDev Focus:
- Using PHP & ListMenu/Select Menu
Example
php_listmenu1.php
<html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <form action="php_listmenu2.php" method="post" name="form1"> List Menu 1<br> <select name="lmName1"> <option value="a">a</option> <option value="b">b</option> <option value="c">c</option> </select> <hr> List Menu 2<br> <select name="lmName2" size="5"> <option value="a">a</option> <option value="b">b</option> <option value="c">c</option> </select> <hr> List Menu 3<br> <select name="lmName3[]" size="5" multiple> <option value="x">x</option> <option value="y">y</option> <option value="z">z</option> </select><br> <input name="btnSubmit" type="submit" value="Submit"> </form> </body> </html>
php_listmenu2.php
<html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <? echo $_POST["lmName1"]; echo "<hr>"; echo $_POST["lmName2"]; echo "<hr>"; for($i=0;$i<=count($_POST["lmName3"]);$i++) { echo " $i = ".$_POST["lmName3"][$i]."<br>"; } echo "<hr>"; ?> </body> </html>
Create a php file and save to path root-path/myphp/
Run
http://localhost/myphp/php_listmenu1.php
Screenshot