实例首页
自学教程
IT工具箱
源代码
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>PHP form select 实例 - 自学教程(runoops.com)</title> </head> <body> <?php $q = isset($_GET['q'])? htmlspecialchars($_GET['q']) : ''; if($q) { if($q =='RUNOOPS') { echo 'Runoops教程<br>http://www.runoops.com'; } else if($q =='GOOGLE') { echo 'Google 搜索<br>http://www.google.com'; } else if($q =='TAOBAO') { echo '淘宝<br>http://www.taobao.com'; } } else { ?> <form action="" method="get"> <select name="q"> <option value="">选择一个站点:</option> <option value="RUNOOPS">runoops</option> <option value="GOOGLE">Google</option> <option value="TAOBAO">Taobao</option> </select> <input type="submit" value="提交"> </form> <?php } ?> </body> </html>
运行结果: