Hi team below code is the form for my website how can I send users to another page after form is submitted I have created that page as well : "https://unicent.in/nagole-admissions-open/Thankyou.html"
can you quickly share some easy method to achieve the output
<!--Course Form-->
<div >
<!--Default Form-->
<div >
<form method="post" action="contact-detail.php">
<input type="hidden" name="contactform" value="2">
<div >
<!--Column-->
<div >
<div >
<!--Form Group-->
<div >
<input type="text" name="name" value="" placeholder="Enter Name*" required>
</div>
<div >
<input type="email" name="email" value="" placeholder="Email Address*" required>
</div>
<!--Form Group-->
<div >
<input type="text" name="mobile" value="" placeholder="Contact Number*" required>
</div>
</div>
</div>
<!--Column-->
<div >
<!--Form Group-->
<div >
<button type="submit" name="submit" >Submit</button>
</div>
</div>
<?php if (isset($_SESSION['msg2'])) { ?>
<div style="margin-top: 20px;">
<div style="text-align: center;">
<div ><?= $_SESSION['msg2'] ?></div>
</div>
</div>
<?php
unset($_SESSION['msg2']);
} ?>
</div>
</form>
</div>
</div>
</div>
</section>
CodePudding user response:
In the contact-detail.php
handler, you can add the following line to redirect using the header function
if( $_SERVER['REQUEST_METHOD'] == 'POST'){
// do some thing with form...
// redirect
header('Location: http://www.example.com/');
}