HTML代码
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<form action="actionPhp.php" method="POST" enctype="multipart/form-data">
<label for="username">姓名</label>
<input type="text" name="username" id="username"><br/>
<label for="sex">性别</label>
<input type="radio" name="sex" id="sex" value="man">man
<input type="radio" name="sex" id="sex" value="woman">woman<br/>
<label for="pwd">密码</label>
<input type="password" name="pwd" id="pwd"><br/>
<label for="edu">学历</label>
<select name="edu" id="edu">
<option value="collage">collage</option>
<option value="highschool">high school</option>
<option value="graduated">graduated</option>
</select><br/>
<label for="hobby">爱好</label>
<input type="checkbox" name="hobby[]" value="book">book
<input type="checkbox" name="hobby[]" value="paint">paint
<input type="checkbox" name="hobby[]" value="sing">sing<br/>
<label for="pic">照片</label>
<input type="file" name="pic" id="pic"><br/>
<label for="info">个人简介</label>
<textarea name="info" id="info"></textarea>
<input type="submit" name="submit">
</form>
</body>
</html>
PHP代码
<?php
if($_POST['submit']!=""){
echo "username is $_POST[username]<br/>";
echo "sex is $_POST[sex]<br/>";
echo "password is $_POST[pwd]<br/>";
echo "school is $_POST[edu]<br/>";
echo "hobbys is";
for($i=0;$i<count($_POST['hobby']);$i++)
echo $_POST['hobby'][$i];
echo '<br/>';
$path='./upfile/'.$_FILES['pic']['name'];
move_uploaded_file($_FILES['pic']['tmp_name'], $path);
echo "information is $_POST[info]";
}
?>