20,359
社区成员
发帖
与我相关
我的任务
分享
";后能不能不清", "upDate": "2021-05-28T19:48:36+08:00" }
<?php
if(!empty($_POST['jhwjjc'])) {
$name2=$_POST['UE_accName'];
$sql2="select * from ot_user where UE_account='".$name2."'";
$result2=mysql_query($sql2) or die("介绍人不正确");
$num2=mysql_num_rows($result2);
if($num2==0){
echo "介绍人不存在";
//echo "<script>alert('介绍人不存在!');theForm.zhxm.focus();</script>";
mysql_close();
}
while($rs=mysql_fetch_object($result2))
{
{
$_SESSION['ot_user']=$_POST['UE_accName'];
echo "介绍存在";
//echo "<script>alert('介绍人存在,可以注册!');theForm.zhxm.focus();</script>";
mysql_close();
}
}
}
就这代码做了个判断文本框的内容和数据内容存在的问题,如果不一致,就做提示或显示“账号不正确,但现在只要出现“账号不正确 就会把我所有的文本框内容清空,好像是刷新了页面一样,能不能就算“账号不正确,也不清空我的文本框内容if(empty($_POST['UE_account']))
echo "<script>alert('帐号不能为空');location='?tj=register';</script>";
else if(empty($_POST['UE_password']))
echo "<script>alert('密码不能为空');location='?tj=register';</script>";
else if($_POST['UE_account']!=$_POST['UE_account1'])
echo "<script>alert('两次登陆用户名不一样');location='?tj=register';</script>";
else if($_POST['UE_password']!=$_POST['pass'])
echo "<script>alert('两次密码不一样');location='?tj=register';</script>";
else if($_POST['UE_secpwd']!=$_POST['UE_secpwd1'])
echo "<script>alert('两次二级密码不一样');location='?tj=register';</script>";
else if($_POST['UE_accName']!=$_POST['UE_accName1'])
echo "<script>alert('两次介绍人用户不一样');location='?tj=register';</script>";
else if($_POST['UE_account']==$_POST['UE_accName'])
echo "<script>alert('介绍人不能为自己!');location='?tj=register';</script>";
//else if(!empty($_POST['weixin'])&&!is_numeric($_POST['weixin']))
// echo "<script>alert('微信号必须全为数字');location='?tj=register';</script>";
else if(!empty($_POST['UE_phone'])&&!is_numeric($_POST['UE_phone']))
echo "<script>alert('手机号码必须全为数字');location='?tj=register';</script>";
else if(!empty($_POST['zfb'])&&!ereg("([0-9a-zA-Z]+)([@])([0-9a-zA-Z]+)(.)([0-9a-zA-Z]+)",$_POST['zfb']))
echo "<script>alert('邮箱输入不合法');location='?tj=register';</script>";
就这样我代码是这样的,是做了个注册的页面, 因为现在是如果别人输错了一个资料就全部文本框都会清空,又要重新输入很麻烦,我现在 就是想,如果别人输入错一个,就提示那个错了,点击确定后继续输入就很了,不要清空文本框。我就是想要JS的办法那样,输错了提示后点击确认,那个内容还在文本框里面,请帮忙看看,在PHP里面实现JS那种效果!
else
if (theForm.UE_password.value.replace(/(^\s*)|(\s*$)/g, "") == ""){
alert("密码不能为空!");
theForm.UE_password.focus();
return (false);
}else if(zhxm3.length<6){
alert("密码至少输入6位数!");
theForm.UE_password.focus();
return (false);
}
if(zhxm4.length<6){
alert("二级密码至少输入6位数!");
theForm.UE_secpwd.focus();
return (false);
}
因为我上次就发了一长长的代码,别人说代码太多了懒得看,我就没有 发了,