2014-04-28 70 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

相關問題