您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

PHP的一个基础知识

2025/9/28 21:44:57发布55次查看
今天在写一个小示例的时候,就是php提交到php中的时候,把$_post写成$_post,结果搞了很久,还是没有取到前台的的值。呵呵,写此博文,权当积累.....下面把这个简单的例子贴一下吧! 
register.php: 
<html> <head> <meta http-equiv="content-type" content="text/html;charset=gb2312"> <title>注册页面</title> </head> <body> <form action="register1.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>
register1.php
<?php $username = $_post['username']; $name = $_post['name']; $pwd = $_post['pwd']; $email = $_post['email']; //print_r($username); if(!emptyempty($username)) { echo "您填写的信息为:<br>\n"; echo "用户名: $username <br>\n"; echo "姓名: $name <br>\n"; echo "密码: $pwd <br>\n"; echo "邮箱: $email <br>\n"; } print_r($_post);//这里是测试你从页面到底封装了那些数据 ?>
当然,你也可以把regiser1.php跟regiser.php写到一起。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product