2021-09-26PHP作业

2021/9/26 20:41:00

本文主要是介绍2021-09-26PHP作业,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
</head>
<body>
<h2>用户注册</h2>
<div class="register">
	<form action="check.php" method="post"> 
		<fieldset>
		<legend>必填字段</legend>
		<div>
			<label for="username">用户:</label>
			<input id="username" type="text" placeholder="用户名不少于6个字符" name="username" required> 
		</div>
		<div>
			<label for="pwd">密码:</label>
			<input id="pwd" type="text" placeholder="密码不少于3个字符" name="pwd" required> 
		</div>
		<div>
			<label for="email">邮箱:</label>
			<input id="email" type="text" placeholder="请输入正确的邮箱格式" name="email" required> 
		</div>
		</fieldset>
		<div>
			<label for="">性别:</label>
			<input id="male" type="radio" name="gender" value="男">
			<label for="male" value="男">男</label>
			<input id="female" type="radio" name="gender" value="女">
			<label for="female" value="女">女</label>
			<input id="sct" type="radio" name="gender" value="保密">
			<label for="sct" value="保密">保密</label>
		</div>
		<div>
			<label for="">爱好:</label>
			<input id="basketbal" type="checkbox" name="body[]" value="篮球">
			<label for="basketbal">篮球</label>
			<input id="football" type="checkbox" name="hobby[]" value="足球">
			<label for="football">足球</label>
			<input id="vallyball" type="checkbox" name="hobby[]" value="排球">
			<label for="vallyball">排球</label>
		</div>
		<div>
			<label for="">专业</label>
			<select name="dept" id="">
				<option value="0">请选择专业</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="01PHP">PHP</option>
				<option value="02英语">英语</option>
				<option value="03数据库">数据库</option>
				<option value="04网络技术">网络技术</option>	
				<option value="05语文">语文</option>
			</select>
		</div>
		<div>
			<label for="">简历</label>
			<textarea name="intruduce" id="" cols="5" rows="5"></textarea>
		</div>
		<button>注册</button>
	</form>
		<style type="text/css">
			.register{
				width: 400px;
				height: 400px;
				background-color: #D9D9;
				padding: 10px;
				margin: 0 auto;
			}
			body h2{
				text-align: center;
			}
		</style>
</body>
</html>

请添加图片描述

<?php 

$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'];
var_dump($hobby);
echo "<br>";

$dept=$_POST['dept'];
echo "专业:$dept";
echo "<br>";

$course=$_POST['course'];
var_dump($course);
//echo "课程:$course";
echo "<br>";

$intruduce=$_POST['intruduce'];
echo "简介:$intruduce";
echo "<br>";

 ?>

请添加图片描述

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>上传文件</title>
</head>
<body>
	<div class="upload" id="upload">
		<form action="upload.php" method="post" enctype="multipart/form-data">
			<input type="file" name="file">
			<button>上传</button>
		</form>
	</div>
</body>
</html>

请添加图片描述

<?php 
$file=$_FILEs['file'];
//echo "$file['name']";
//echo "file['file']";
//var_dump($file);
$imgfile="";
if ($file['error']==0) {
	$imgfile="img/".$file['name'];
	move_uploaded_file($file['tmp_name'],$imgfile);
}
 ?>![请添加图片描述](https://www.www.zyiz.net/i/ll/?i=f01f71d27c7f4be8a2083a44eacc1d72.png)

 <img src="<?php echo $imgfile ?>"alt="图片">

请添加图片描述



这篇关于2021-09-26PHP作业的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程