标签:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>全局变量</title>
<meta name="keywords" content="关键字">
<meta name="description" content="简介">
</head>
<body>
<form method="post" action="formp.php">
用户名:<input type="text" name="username"><br>
密码: <input type="password" name="passwd"><br>
性别:<input type="radio" name="sex" value="man">男
<input type ="radio" name="sex" value="woman">女<br>
你喜欢什么:
<input type="checkbox" name="fun[]" value="唱歌">唱歌
<input type="checkbox" name="fun[]" value="游泳">游泳
<input type="checkbox" name="fun[]" value="运动">运动
<input type="checkbox" name="fun[]" value="跳舞">跳舞
<br>
个人介绍:
<textarea name="intro" rows="10" cols="30">
</textarea><br>
请选择图片<input type="file" name="myphoto"><br>
<br>
你的所在地是:
<select name="city">
<option value="beijing">北京</option>
<option value="shanghai">上海</option>
<option value="zhengzhou">郑州</option>
</select>
<br><input type="submit" value="提交">
</form>
</body>
</html>
<?php
echo ‘<pre>‘;
echo print_r($_POST);
//只关心爱好
$name=$_POST[‘username‘];
$pwd=$_POST[‘passwd‘];
$funs=$_POST[‘fun‘];
echo "个人信息如下<br>";
echo "$name--$pwd";
//print_r($funs);
echo "该人的爱好";
foreach($funs as $key=>$val){
echo "<br>$key=$val";
}
echo "<br>个人介绍如下";
$intro=$_POST[‘intro‘];
echo "<br>$intro";
$myphoto=$_POST[‘myphoto‘];
echo"<br>$myphoto";
$city=$_POST[‘city‘];
echo "<br>$city";
echo "<a href=‘#‘>查看调查情况</a>"
?>
标签:
原文地址:http://www.cnblogs.com/lsr111/p/4482112.html