注册页面: zhuce.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<form name="form1" method="post" action="jieshao.php" enctype="multipart/form-data">
<table align="center" bgcolor="#BBBBBB">
<caption>请输入你的个人信息</caption>
<tr>
<td>
姓名:<input type="text" name="user">
</td>
</tr>
<tr>
<td>
性别:<input type="radio" name="sex" value="1" checked>女<input type="radio" name="sex" value="0">男<p>
</td>
</tr>
<tr>
<td>
出生年月:
<select name="year"><?php
for ($i=1900; $i<=2022 ; $i++) {
echo '<option value='.$i.'>'.$i.'年</option>';
}
?>
</select>
<select name="month">
<?php
for ($i=1; $i<=12 ; $i++) {
echo '<option value='.$i.'>'.$i.'月</option>';
}
?>
</select>
</td>
</tr>
<tr>
<td>
喜好:<input type="checkbox" name="like[]" value="看电影">看电影
<input type="checkbox" name="like[]" value="听音乐">听音乐
<input type="checkbox" name="like[]" value="演奏乐器">演奏乐曲
<input type="checkbox" name="like[]" value="打篮球">打篮球
<input type="checkbox" name="like[]" value="看书">看书
<input type="checkbox" name="like[]" value="上网">上网
</td>
</tr>
<tr>
<td>
地址:<input type="text" name="address">
</td>
</tr>
<tr>
<td>
电话:<input type="text" name="phone">
</td>
</tr>
<tr>
<td>
QQ:<input type="text" name="qq">
</td>
</tr>
<tr>
<td>
自我评价:<br>
<textarea name="remark" cols="20" rows="4">请输入自我评价信息</textarea>
</td>
</tr>
<tr>
<td>
上传个人照片:<input type="file" name="upfile">
</td>
</tr>
<tr>
<td>
<input type="submit" name="submit" value="提交">
<input type="reset" name="reset" value="重置">
</td>
</tr>
</table>
</form>
</body>
</html>
jiaoshao.php:接收传过来的值
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<table align="center" bgcolor="#BBBBBB">
<tr>
<td>
姓名:
</td>
<td>
<?php
echo $_POST['user'];
?>
</td>
</tr>
<td>
性别:
</td>
<td>
<?php
echo $_POST['sex']==0?'男':'女';
?>
</td>
<tr>
<td>
出生年月:
</td>
<td>
<?php
echo $_POST['year'].'年'.$_POST['month'].'月';
?>
</td>
</tr>
<tr>
<td>
喜好:
</td>
<td>
<?php
for ($i=0; $i<count($_POST['like']);$i++){
echo $_POST['like'][$i]."\n";
}
?>
</td>
</tr>
<tr>
<td>
地址:
</td>
<td>
<?php
echo $_POST['address'];
?>
</td>
</tr>
<tr>
<td>
电话:
</td>
<td>
<?php
echo $_POST['phone'];
?>
</td>
</tr>
<tr>
<td>
QQ:
</td>
<td>
<?php
echo $_POST['qq'];
?>
</td>
</tr>
<tr>
<td>
个人评价:
</td>
<td>
<?php
echo $_POST['remark'];
?>
</td>
</tr>
<tr>
<td>
信息:
</td>
<td>
<?php
if(!empty($_FILES)){
foreach ($_FILES['upfile'] as $name => $value) {
# code...
echo $name.'='.$value.'br';
}
}
?>
</td>
</tr>
</table>
</body>
</html>
输入信息: