就是有两个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>
<?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 id="btn_reg" name="btn_reg" onclick="location.href='xxx.php';" type="button" value="注册" />