PHP的一个基础知识 表单提交
程序员文章站
2022-06-20 14:23:58
register.php: 复制代码 代码如下:
register.php:
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=gb2312">
<title>注册页面</title>
</head>
<body>
<form action="request.php" method="post" name="registform">
<table width="330" border="0" align="center" cellpadding="5" bgcolor="#eeeeee">
<tr>
<td width="40%">用户名:</td>
<td><input name="username" type="text" id="username"/></td>
</tr>
<tr>
<td>姓名:</td>
<td><input name="name" type="text" id="name"/></td>
</tr>
<tr>
<td>密码:</td>
<td><input name="pwd" type="text" id="pwd"/></td>
</tr>
<tr>
<td>邮箱:</td>
<td><input name="email" type="text" id="email"/></td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="提交" name="submit"/>
<input type="reset" value="重置" name="button"/>
</td>
</tr>
</table>
</form>
</body>
</html>
request.php
<?php
$username = $_post['username'];
$name = $_post['name'];
$pwd = $_post['pwd'];
$email = $_post['email'];
//print_r($username);
if(!empty($username))
{
echo "您填写的信息为:<br>\n";
echo "用户名: $username <br>\n";
echo "姓名: $name <br>\n";
echo "密码: $pwd <br>\n";
echo "邮箱: $email <br>\n";
}
print_r($_post)
//echo "aaaa";
?>
</pre>
</div>
当然,你也可以把request跟regiser.php写到一起。
复制代码 代码如下:
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=gb2312">
<title>注册页面</title>
</head>
<body>
<form action="request.php" method="post" name="registform">
<table width="330" border="0" align="center" cellpadding="5" bgcolor="#eeeeee">
<tr>
<td width="40%">用户名:</td>
<td><input name="username" type="text" id="username"/></td>
</tr>
<tr>
<td>姓名:</td>
<td><input name="name" type="text" id="name"/></td>
</tr>
<tr>
<td>密码:</td>
<td><input name="pwd" type="text" id="pwd"/></td>
</tr>
<tr>
<td>邮箱:</td>
<td><input name="email" type="text" id="email"/></td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="提交" name="submit"/>
<input type="reset" value="重置" name="button"/>
</td>
</tr>
</table>
</form>
</body>
</html>
request.php
复制代码 代码如下:
<?php
$username = $_post['username'];
$name = $_post['name'];
$pwd = $_post['pwd'];
$email = $_post['email'];
//print_r($username);
if(!empty($username))
{
echo "您填写的信息为:<br>\n";
echo "用户名: $username <br>\n";
echo "姓名: $name <br>\n";
echo "密码: $pwd <br>\n";
echo "邮箱: $email <br>\n";
}
print_r($_post)
//echo "aaaa";
?>
</pre>
</div>
当然,你也可以把request跟regiser.php写到一起。
上一篇: 需遵守三个原则 针灸亦可美容
下一篇: Go语言的并发