How can I make my button ""input type="submit" value="Create" class="btn btn-default" " also redirect to another page(View) after submitting? Basically, I made a simple Form which sends email after that button click, and automatically returns me to Index page (default controller option(asp.net mvc core)), and i want to redirect it to another "Thank you for submitting an email" page(View).
2
votes
4 Answers
2
votes
2
votes
// in PHP you can use
redirect('thank-you.php');
or
header('location:thank-you.php');
/* function for redirect index or home page after some time you can write a setTimeout function in thank-you page.*/
<script>
$(function(){
setTimeout(function(){ window.location.href = "index.php"; }, 3000);
});
</script>
// I hope this is work for you.
1
votes
use action attribute inside form element that will redirect you to the page where you want it to be,
just you need to give the link or directory of that file or page or if you have created routing, then give route path according to the framework you are using this will help you for clear understanding
<form action="another_page.php">
<input type="text">
<button type="submit">
</form>