admin管理员组文章数量:1410717
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
本文标签: javascriptHow do I make submit button redirect to another pageStack Overflow
版权声明:本文标题:javascript - How do I make submit button redirect to another page? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745012490a2637635.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论