读书人

php点击注册页面跳转的有关问题

发布时间: 2012-03-09 21:42:52 作者: rapoo

php点击注册页面跳转的问题
就是有两个submit型的按钮,一个登录,一个注册,两个按钮分别可以跳转到不同的页面,怎么实现呢??


<?php
/*
* Created on 2012-1-17
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
error_reporting(0);

include("dblink.php");
if ($_POST["submit1"])
{
$us="insert into userlist(user,psw)values('$_POST[user]','$_POST[psw]')";
mysql_query($us);
}


?>
<script language="JavaScript" type="text/javascript">
function check(){
if(login.user.value==""){

alert("用户名不能是空!");
login.user.focus();
return false;
}

if(login.psw.value.length!=6){
alert("密码必须是六位!");
login.psw.focus();
return false;
}


}

</script>

<form name="denglu" method="post" >
<table>
<tr>
<td>用户名:<input name="user" type="text" ></td></tr>
<tr>
<td>密  码:<input name="psw" type="password" ><p>

        <input nmae="submit1" type="submit" value="登录"onClick="return check();" >
<input nmae="submit2" type="submit" value="注册" onclick="return iff()" >
</td>
</tr>
</table></form>


[解决办法]
<input nmae="submit2" type="submit" value="注册" onclick="return iff()" >

--->

<input nmae="submit2" type="button" value="注册" onclick="location.href='reg.php';" >

读书人网 >PHP

热点推荐