一个关于注册的php页面
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=GB2312" /><title>学生注册</title></head><body><?php //######################学生注册########################## include "config.php"; include "header.php";?><?php if ($xuehao=="" ||$name=="" || $class=="" ||$password=="" ||$password1=="" ||$telephone=="") { echo"<p align=\"center\"><font color=\"#FF0000\"><b><big>请把信息添写完整</big></b></font></p>"; echo "<meta http-equiv=\"refresh\" content=\"1;url=student_register.php\">"; exit; } $query="select * from $student_infor where no='$xuehao' and name='$name'"; mysql_query("set names 'GB2312'"); $result=mysql_query($query); $row=mysql_fetch_array($result); if($row==0) { echo"<p align=\"center\"><font color=\"#FF0000\"><b><big>你输入的信息有误,不属于计算机学院毕业生!</big></b></font></p>"; echo "<meta http-equiv=\"refresh\" content=\"2;url=student_register.php\">"; exit; } $query="select * from $student_table where xuehao='$xuehao'"; mysql_query("set names 'GB2312'"); $result=mysql_query($query); $row=mysql_fetch_array($result); if($row!=0) { echo"<p align=\"center\"><font color=\"#FF0000\"><b><big>此学号已注册,请重新填写!</big></b></font></p>"; echo "<meta http-equiv=\"refresh\" content=\"2;url=student_register.php\">"; exit; } if($password!=$password1) { echo"<p align=\"center\"><font color=\"#FF0000\"><b><big>输入的密码不一致,请重新输入!</big></b></font></p>"; echo "<meta http-equiv=\"refresh\" content=\"2;url=student_register.php\">"; exit; } $query="insert into $student_table values('$xuehao','$name','$sex','$class','$password','$love','$telephone','$reward','')"; mysql_query("set names 'GB2312'"); $result=mysql_query($query); if($result==true){ echo "<p align=\"center\"><font color=\"#FF0000\"><b><big>注册成功!</big></b></font></p>"; echo "<meta http-equiv=\"refresh\" content=\"1;url=index.php\">"; exit; }?><?php include "foot.php";?></body></html>
回复讨论(解决方案)
这是显示结果,显示2秒后就又跳转回注册页面了,哪里出错了?
$xuehao...这几个变量是哪里来的?
$xuehao...这几个变量是哪里来的? 这是我的另一个php页面
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=GB2312" /><title>学生注册页面</title><style type="text/css"><!--.STYLE1 { font-size: 14px; color: #FF0000;}.STYLE2 {color: #FF0000}.STYLE3 {font-size: 14px}.STYLE4 {font-size: 14px; color: #000000; }.STYLE5 {font-size: 12px}--></style></head><body><?php //######################学生注册########################## include "config.php"; include "header.php";?> <p></p><p></p><table width="600" border="1" align="center" cellpadding="0" cellspacing="1" class="text"> <!--DWLayoutTable--> <form name="form1" method="post" action="register.php"> <tr bgcolor="#E4E4E4"> <td height="27" colspan="3"><span class="STYLE1 STYLE2 STYLE1">>>>学生注册</span></td> </tr> <tr> <td width="148" bgcolor="#FFFFFF"><div align="center" class="STYLE2"> <div align="right" class="STYLE4">学号:</div> </div></td> <td width="443" bgcolor="#FFFFFF" height="39"> <input type="text" name="xuehao" size="25"> <span class="STYLE5">*输入你的学号</span></td> </tr> <tr> <td width="148" bgcolor="#E4E4E4"><div align="center" class="STYLE4"> <div align="right">姓名:</div> </div></td> <td width="443" bgcolor="#E4E4E4" height="36"> <input type="text" name="name" size="25"> <span class="STYLE5">*输入你的真实姓名 </span></td> </tr> <tr> <td width="148" bgcolor="#FFFFFF"><div align="center" class="STYLE2"> <div align="right" class="STYLE4">性别:</div> </div></td> <td width="443" bgcolor="#FFFFFF" height="41"> <label> <select name="sex"> <option> </option> <option> 男 </option> <option> 女 </option> </select> </label></td> </tr> <tr> <td width="148" bgcolor="#E4E4E4"><div align="center" class="STYLE4"> <div align="right">班级:</div> </div></td> <td width="443" bgcolor="#E4E4E4" height="36"> <input type="text" name="class" size="25"> <span class="STYLE5">*本科所在班级 </span></td> </tr> <tr> <td width="148" bgcolor="#FFFFFF"><div align="center" class="STYLE2"> <div align="right" class="STYLE4">密码:</div> </div></td> <td width="443" bgcolor="#FFFFFF" height="41"> <input type="password" name="password" size="25"> <span class="STYLE5">*输入密码,选题时用,长度为3-16位 </span></td> </tr> <tr> <td width="148" bgcolor="#E4E4E4"><div align="center" class="STYLE4"> <div align="right">确认密码:</div> </div></td> <td width="443" bgcolor="#E4E4E4" height="41"> <input type="password" name="password1" size="25"> <span class="STYLE3"> </span><span class="STYLE5">*请再次输入密码</span> </td> </tr> <tr> <td width="148" bgcolor="#FFFFFF"><div align="center" class="STYLE2"> <div align="right" class="STYLE4">专业爱好:</div> </div></td> <td width="443" bgcolor="#FFFFFF" height="41"><input type="text" name="love" size="25"> <span class="STYLE5">所学专业方面的爱好</span> </td> </tr> <tr> <td width="148" bgcolor="#E4E4E4"><div align="center" class="STYLE2"> <div align="right" class="STYLE4">联系方式:</div> </div></td> <td width="443" bgcolor="#E4E4E4" height="41"><input type="text" name="telephone" size="25"> <span class="STYLE5">*任一联系方式,方便老师联系 </span></td> </tr> <tr> <td width="148" bgcolor="#FFFFFF"><div align="center" class="STYLE4"> <div align="center">本科阶段取得的主要成绩及特长:</div> </div></td> <td width="443" bgcolor="#FFFFFF" height="163"><label> <textarea name="reward" cols="60" rows="10"></textarea> </label></td> </tr> <tr bgcolor="#E4E4E4"> <td height="25" colspan="2" align="center"><input type="hidden" name="add" value="1"> <input name="submit" type="submit" class="STYLE4" value="提交"> <input type="button" name="back" class="STYLE4" onclick="window.location='index.php'" value="返回"></td> </tr> </form></table><p></p><?php include "foot.php"?> </body></html>
那也是$_POST['xuehao'] 呀
那也是$_POST['xuehao'] 呀 什么意思?
错误提示:$xuehao未定义!!!
register.php
extract($_POST); //加上这句
if ($xuehao=="" ||$name=="" || $class=="" ||$password=="" ||$password1=="" ||$telephone=="")
是不是可以这样理解呢?
$heihao 定义的变量。。
$_GET['xuehao'] 才是从另一个页面传递过来的呢。。
我也是菜鸟,刚接触
register.php
extract($_POST); //加上这句
if ($xuehao=="" ||$name=="" || $class=="" ||$password=="" ||$password1=="" ||$telephone=="") 感谢,问题解决了!

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

会话劫持可以通过以下步骤实现:1.获取会话ID,2.使用会话ID,3.保持会话活跃。在PHP中防范会话劫持的方法包括:1.使用session_regenerate_id()函数重新生成会话ID,2.通过数据库存储会话数据,3.确保所有会话数据通过HTTPS传输。

JWT是一种基于JSON的开放标准,用于在各方之间安全地传输信息,主要用于身份验证和信息交换。1.JWT由Header、Payload和Signature三部分组成。2.JWT的工作原理包括生成JWT、验证JWT和解析Payload三个步骤。3.在PHP中使用JWT进行身份验证时,可以生成和验证JWT,并在高级用法中包含用户角色和权限信息。4.常见错误包括签名验证失败、令牌过期和Payload过大,调试技巧包括使用调试工具和日志记录。5.性能优化和最佳实践包括使用合适的签名算法、合理设置有效期、

在PHPStorm中如何进行CLI模式的调试?在使用PHPStorm进行开发时,有时我们需要在命令行界面(CLI)模式下调试PHP�...

SOLID原则在PHP开发中的应用包括:1.单一职责原则(SRP):每个类只负责一个功能。2.开闭原则(OCP):通过扩展而非修改实现变化。3.里氏替换原则(LSP):子类可替换基类而不影响程序正确性。4.接口隔离原则(ISP):使用细粒度接口避免依赖不使用的方法。5.依赖倒置原则(DIP):高低层次模块都依赖于抽象,通过依赖注入实现。

如何在系统重启后自动设置unixsocket的权限每次系统重启后,我们都需要执行以下命令来修改unixsocket的权限:sudo...

静态绑定(static::)在PHP中实现晚期静态绑定(LSB),允许在静态上下文中引用调用类而非定义类。1)解析过程在运行时进行,2)在继承关系中向上查找调用类,3)可能带来性能开销。

使用PHP的cURL库发送JSON数据在PHP开发中,经常需要与外部API进行交互,其中一种常见的方式是使用cURL库发送POST�...
