实例首页
自学教程
IT工具箱
源代码
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>PHP 单选 实例 - 自学教程(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"> <input type="radio" name="q" value="RUNOOPS" />Runoops <input type="radio" name="q" value="GOOGLE" />Google <input type="radio" name="q" value="TAOBAO" />Taobao <input type="submit" value="提交"> </form> <?php } ?> </body> </html>
运行结果: