----- 011-form.html -----
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta http-equiv="content-type" content="text/html; charset=utf-8"> 5 <title>一个PHP网页</title> 6 </head> 7 <body> 8 <center> 9 <form action="011-post.php"> 10 随便选择几句:<br/> 11 <select multiple="multiple" name="tower[]"> 12 <option>白日依山尽</option> 13 <option>黄河入海流</option> 14 <option>欲穷千里目</option> 15 <option>更上一层楼</option> 16 </select><br/> 17 <input type="submit" value="提交"> 18 </form> 19 </center> 20 </body> 21 </html>
----- 011-post.php -----
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta http-equiv="content-type" content="text/html; charset=utf-8"> 5 <title>一个PHP网页</title> 6 </head> 7 <body> 8 <?php 9 if(isset($_GET[‘tower‘])) 10 foreach ($_GET[‘tower‘] as $value) { 11 echo $value, "<br/>"; 12 } 13 else 14 echo "一个没选"; 15 ?> 16 </body> 17 </html>