1、内容
包含两个php文件
2、代码
. d1.php源代码
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div class="register">
<h2>用户注册界面</h2>
<!--action属性代表目标文件>
<method是提交方式:get(默认),post>
<get:提交到地址栏,使用于数据量比较小的提交>
<post:提交到文件的请求头,适用于规范数据量较大,更安全-->
<form action="check.php?y=100" method="post">
<fieldset>
<legend>必填选项</legend>
<div class="username">
<label for="username">用户名:</label>
<input id="usename" type="text" name="username" placeholder="用户名不少于4个字符"
autofocus
required
>
</div>
<div class="username">
<label for="password">密码:</label>
<input id="password" type="password" name="password" placeholder="请输入密码,不少于6位">
</div>
<div class="username">
<label for="email">邮箱:</label>
<input id="email" type="email" name="email" placeholder="请输入邮箱地址">
</div>
<div class="username">
<label for="male">性别:</label>
<input id="male" name="gender" type="radio" value="男"><label for="male">男</label>
<input id="remale" name="gender" type="radio" value="女"><label for="remale">女</label>
</div>
<div class="username">
<label for="numb">手机号:</label>
<input id="numb" name="numb" type="numb" placeholder="请输入手机号" required="">
</div>
</fieldset>
<button>提交</button>
</form>
</div>
<style>
.register{
width: 400px;
margin:0 auto;
background-color:
padding: 10px
}
.register>h2{
text-align: center;
color:
}
.username{
margin-left: 70px;
margin-top: 20px;
}
</style>
</body>
</html>
.check.php代码
<?php
$username = $_REQUEST["username"]??"";
$paw = $_POST["password"];
$email = $_POST["email"];
$gender = $_POST["gender"];
$numb = $_POST["numb"];
echo "用户名:".$username;
echo "<br>";
echo "密 码:".$paw;
echo "<br>";
echo "邮 箱:".$email;
echo "<br>";
echo "性 别:".$gender;
echo "<br>";
echo "手机号:".$numb;
?>
3、运行结果加代码截图
d1.php
check.php 代码截图 d1.php
check.php
|