I'm trying to figure out how to make the "Submit" button redirect to another page. For example once the user pletes 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.
I'm trying to figure out how to make the "Submit" button redirect to another page. For example once the user pletes 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.
Share Improve this question asked Dec 5, 2016 at 12:53 okarimokarim 411 gold badge1 silver badge6 bronze badges 4-
1
You are looking for the
action
attribute of the form tag : w3schools./tags/att_form_action.asp – Tmb Commented Dec 5, 2016 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 Commented Dec 5, 2016 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.";
– Satinder singh Commented Dec 5, 2016 at 12:57 - Possible duplicate of How to make a redirect in PHP? – Funk Forty Niner Commented Dec 5, 2016 at 13:03
4 Answers
Reset to default 1This 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>
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>
use form to make it simple and clear
<form action="login.aspx" method="get">
<input type="submit" value="Submit">
</form>
Try to add onclick event,
onclick="window.location.href = 'http://stackoverflow./';
this will open the url in the same window.
window.open(url)
will open the link in a new window
https://jsfiddle/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.');">{translate text='register'}</button>
</div>
</div>
Hope i helped