register.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>用户注册</title>
</head>
<body>
<h2>用户注册</h2>
<div class="d1">
<form action="check.php" method="post">
<fieldset>
<legend>必填字段</legend>
<div>
<label for="username">用户:</label>
<input id="username" type="text" name="username" autofocus placeholder="用户名不少于6个字符">
</div>
<div>
<label for="pwd">密码:</label>
<input id="pwd" type="password" name="pwd" placeholder="密码要高强度保密" required>
</div>
<div>
<label for='email'>邮箱:</label>
<input id="email" type="email" name="email" placeholder="请输入正确的邮箱格式" >
</div>
</fieldset>
<div>
<label for="sct">性别:</label>
<input id="male" type="radio" name="gender" value="male">
<label for="male">男</label>
<input id="sct" type="radio" name="gender" vaule="女">
<label for="female">女</label>
</div>
<div>
<label for="">爱好:</label>
<input id="basketbal" type="checkbox" name= "hobby[ ]" value="篮球">
<label for="basketbal">篮球</label>
<input id="football" type="checkbox" name= "hobby[]" value="足球">
<label for="football">足球</label>
<input id="vollyball" type="checkbox" name= "hobby[]" value="排球">
<label for="vollyball">排球</label>
</div>
<div>
<label for="">专业:</label>
<select name= "dept" id="">
<option value="O">请选择专业</option>
<option value="1">软件技术</option>
<option value="2">云计算应用技术</option>
<option value="3">大数据应用技术</option>
<option value="4">物联网应用技术</option>
</select>
</div>
<div>
<label for="">课程</label>
<select name= "course[]" id="" multiple= "multiple">
<option value="01">PHP</option>
<option value="02">英语</option>
<option value="03">数据库</option>
<option value="04">网络技术</option>
</select>
</div>
<div>
<label for="">简历:</label>
<textarea rows="10" cols="30">
</textarea>
</div>
<button>注册</button>
</form>
<div class="upload" id="upload">
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="file" name="file">
<button>上传</button>
</form>
</div>
</div>
<style type="text/css">
.d1{
width: 400px;
height: 500px;
background-color: #5aa;
padding: 5px;
margin:0 auto;
}
</style>
</body>
</html>
check.php
<?php
$username=$_POST['username'];
// $username=isset($_POST[ " username " ])?$_POST: "";4$username=$_POST[ 'username ' ]??"";
var_dump($username);
$pwd=$_POST[ ' pwd '];
echo "$pwd" ;
echo "<br>";
$email=$_POST[ ' email' ];
echo "邮箱:$email";
echo "<br>";
$gender=$_POST['gender'];
echo "性别:$gender";
echo "<br>";
$hobby=$_POST['hobby'];
echo "爱好:$hobby";
$dept=$_POST['dept'];
echo "专业代码:$dept";
echo "<br>课程:";
$course=$_POST['course'];
var_dump($course);
?>
upload.php
<?php
$file=$_FILES['file'];
//echo $file['name'];
//echo $file['type];
// var_dump ($file);
$imgfile="";
if($file['error']==O){
$imgfile="img/".$file['name'];
$move check file($file[ ' tmp_name ' ],$imgfile);
}
?>
<img src=" <?php echo $imgfile ?>" alt="
这是个图片">
效果图: