PHP与Web页面交互--表单Form与参数值获取方式 Dreamweaver编辑器,Wampserver服务器
<body>
<form method="post" name="form1" style="border:1px solid #09F" >
<div class="row">
用户名:<input type="text" name="username"/>@
<select name="cars">
<option value="qq.com">qq.com</option>
<option value="163.com" selected>163.com</option>
</select>
</div>
<div class="row">
登录密码:<input type="password" name="password" />
</div>
<div class="row">
确认密码:<input type="password" name="password" />
</div>
<div class="row">
选择性别:
<label>
<input type="radio" name="sex" value="男" checked="checked"/>男
</label>
<label>
<input type="radio" name="sex" value="女"/>女
</label>
</div>
<div class="row">
<label>
<input type="checkbox" name="hobby[]" value="音乐" checked="checked"/>音乐
</label>
<label>
<input type="checkbox" name="hobby[]" value="游戏" checked="checked"/>游戏
</label>
<label>
<input type="checkbox" name="hobby[]" value="电影"/>电影
</label>
</div>
<div class="row ">
个人相片:<input type="text" name="picture" />
<input type="file" name="file" value=" " id="file" />
</div>
<div class="row">
备注信息:<textarea name="textarea" ></textarea>
</div>
<div class="row">
<input type="submit" name="submit" value="提交表单"/>
<input type="reset" name="reset" value="重新填写"/>
</div>
</form>
<?php
if(isset($_POST['submit']))
{
echo '您填写的用户名为:'.$_POST['username']."<br/>";
echo '您注册的邮箱域名为:'.'@'.$_POST['cars']."<br/>";
echo '您填写的登录密码为:'.$_POST['password']."<br/>";
echo '您填写的确认密码为:'.$_POST['password']."<br/>";
echo '您填写的性别为:'.$_POST['sex']."<br/>";
echo '您填写的个人爱好为:';
foreach( $_POST['hobby'] as $value)
{
echo $value." ";
}
echo "<br/>";
echo '您填写的备注信息为:'.$_POST['textarea']."<br/>";
}
?>
</body>
运行结果