<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<meta charset="UTF-8">
<title>fuck</title>
</head>
<body>
<?php
$q = isset($_POST[‘q‘])? htmlspecialchars($_POST[‘q‘]) : ‘‘;
if($q) {
if($q ==‘RUNOOB‘) {
echo ‘菜鸟教程<br>http://www.runoob.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="RUNOOB">Runoob</option>
<option value="GOOGLE">Google</option>
<option value="TAOBAO">Taobao</option>
</select>
<input type="submit" value="提交">
</form>
<?php
}
?>
</body>
</html>
表单method使用get,被响应的php(表单种action提交指向的php)可以使用$_GET、$REQUEST
表单method使用post,被响应处理的php可以使用$_POST、$_REQUEST