1

I'm trying to figure out how to make the "Submit" button redirect to another page. For example once the user completes the registration form then clicks "Submit" the user is then redirected to the login page.

 <div class="form-group">
            <div class="checkbox col-sm-10 col-sm-offset-2">
                <button type="submit" name="submitf" value="register" class="btn_dark_grey">{translate text='register'}</button>
            </div>      
        </div>

Thanks in advance.

okarim
  • 41
  • 1
  • 1
  • 6
  • 1
    You are looking for the `action` attribute of the form tag : http://www.w3schools.com/tags/att_form_action.asp – Tmb Dec 05 '16 at 12:55
  • 2
    that redirection can be done from the backend. so your form submits on url for ex. /submit at that url just redirect to the url where you want. – Sagar Rabadiya Dec 05 '16 at 12:55
  • You have to do this on server-side , if still you want to done at client side then use `window.location.href = "http://stackoverflow.com";` – Satinder singh Dec 05 '16 at 12:57
  • Possible duplicate of [How to make a redirect in PHP?](http://stackoverflow.com/questions/768431/how-to-make-a-redirect-in-php) – Funk Forty Niner Dec 05 '16 at 13:03

4 Answers4

1

This can be done by using the html "form" element. So you can simply do it by

<form action="login.php" method="post">
 <div class="form-group">
        <div class="checkbox col-sm-10 col-sm-offset-2">
            <button type="submit" name="submitf" value="register" class="btn_dark_grey">{translate text='register'}</button>
        </div>      
    </div>
</form>
Saurabh
  • 71
  • 7
0

Try using your code.

Which will be similar to this:

<form action="action_page.php">
  First name:<br>
  <input type="text" name="firstname" value="Mickey"><br>
  Last name:<br>
  <input type="text" name="lastname" value="Mouse"><br><br>
  <input type="submit" value="Submit">
</form> 
Christa
  • 73
  • 1
  • 13
0

use form to make it simple and clear

<form action="login.aspx" method="get">
    <input type="submit" value="Submit">
</form>
Developer
  • 460
  • 4
  • 17
0

Try to add onclick event, onclick="window.location.href = 'http://stackoverflow.com/'; this will open the url in the same window.

window.open(url) will open the link in a new window https://jsfiddle.net/sjo02rqe/

 <div class="form-group">
   <div class="checkbox col-sm-10 col-sm-offset-2">
     <button type="submit" name="submitf" value="register" class="btn_dark_grey" onclick="window.open('http://www.google.com');">{translate text='register'}</button>
   </div>
 </div>

Hope i helped

Saurav Rastogi
  • 9,575
  • 3
  • 29
  • 41