2014-04-28 73 views
0

我正在设计一个登录页面,使用html和php.it包括两个按钮一个用于登录,另一个重定向到注册page.i计划使用php代码验证同一page.here登录数据是我的代码php:在同一个表单和表单提交中使用两个按钮

<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="post"> 
<div> 
    <table style="width: 100%; height: 377px;"> 
     <tr> 
      <td rowspan="4"><img src="woman.jpg" height="100%" width="100%" alt="woman"/></td> 
      <td>&nbsp;</td> 
      <td>&nbsp;</td> 
      <td>&nbsp;</td> 
     </tr> 


     <tr> 
      <td>&nbsp;</td> 
      <td>&nbsp;</td> 
      <td align="right" style="padding:0px;color:white" >username:</td> 
      <td><input runat="server" name="Text1" type="text" /></td> 
     </tr> 
     <tr> 
      <td>&nbsp;</td> 
      <td>&nbsp;</td> 
      <td align="right" style="padding:0px;color:white">password</td> 
      <td><input runat="server" name="Text2" type="text" /></td> 
     </tr> 
     <tr> 
      <td>&nbsp;</td> 
      <td>&nbsp;</td> 
      <td></td> 
      <td ><input name="Submit1" type="submit" value="login" />&nbsp; 
      <input onclick="document.location.href='regforswa.php'" name="Submit2" type="submit" value="register" /><br/> 
      <a href="fp.php" style="color:white">forgot password</a></td> 
     </tr> 
    </table> 
</div> 

</form> 

,但注册的按钮不工作properly.it不重定向到登记page.i不想把表格外注册按钮我想保持相同的设计并实现所需的功能。

+0

你为什么不使注册按钮类型为type =“按钮” –

回答

1

更改钮扣型从type="submit"type="button"禁用形式提交:

<input onclick="document.location.href='regforswa.php'" name="Submit2" type="button" value="register" /> 
+0

谢谢sir.now是工作fine.sir你可以请建议我一些网站学习前端设计/ – shreesha

+0

不是。我不是设计师;) –

+0

:)其确定sir.once再次感谢您的答案。 – shreesha

相关问题