2016-03-19 38 views
1

在我的表格標籤我有兩個按鈕名爲SIGNIN和SIGNUP和表單應提交如果SIGNIN按鈕按下。如果SIGNUP按鈕按下它應該重定向到下面定位標記中給出的url,但它總是提交表單。請幫幫我。按鈕裏面的表格不應該提交表格

<form action="controllers/user/vauth.php" method="post" role="form" class="userLogin" style="padding:20px;"> 
    <div class='alert alert-danger' id='errorLabel' style="display:none;"></div> 
     <?php 
     if(isset($_SESSION['error'])) { 
     echo "<div class='alert alert-danger' id='errorLabel'>"; 
     foreach($_SESSION['error'] as $error) echo "<p><b>".$error."</b></p>"; 
     echo "</div>"; 
     unset($_SESSION['error']); 
     } 
     if(isset($_SESSION['message'])) { 
     echo "<div class='alert alert-success'>".$_SESSION['message']."</div>"; 
     unset($_SESSION['message']); 
     } 
     ?> 
     <div class="form-group"> 
     <label for="email">Email</label> 
     <input type="text" name="vemail" id="vemail" class="form-control" placeholder="Enter Email" value="<?php if(isset($_SESSION['values'])) echo $_SESSION['values']['email']; ?>"> 
     </div> 
     <div class="form-group"> 
     <label for="password">Password</label> 
     <input type="password" name="vpassword" id="vpassword" class="form-control" placeholder="Enter Password"> 
     </div> 
     <div class="form-group"> 
     <a href="user/vfpass.php">Forgot Password ?</a> 
    </div> 
    <button type="submit" class="btn btn-default" name="vsubmit">LOG IN</button><a href="../signup"><button class="btn btn-success" name="signup" style="float:right;">SIGN UP</button></a> 
</form> 
+2

變化按鈕類型,以'button',而不是'submit'。 – Lal

+0

爲什麼不移動

標籤之外的第二個按鈕(註冊)? – ItayB

+0

@Lal你看過代碼嗎?他沒有使用第二個按鈕提交。 – ItayB

回答

4

添加type="button"到您的註冊按鈕