PHP的一个基础知识 表单提交

高洛峰
发布: 2023-03-04 18:32:01
原创
1050 人浏览过

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[&#39;username&#39;]; 
$name = $_POST[&#39;name&#39;]; 
$pwd = $_POST[&#39;pwd&#39;]; 
$email = $_POST[&#39;email&#39;]; 
//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"; 
?> 
登录后复制

当然,你也可以把request跟regiser.php写到一起。

更多PHP的一个基础知识 表单提交相关文章请关注PHP中文网!

相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
热门推荐
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!