Below mentioned code is my form code
<form class="contact100-form validate-form" method="post" action-xhr="https://www.aptadvantage.com/popup_2.php">
<div class="wrap-input100 validate-input" data-validate="Name is required">
<input class="input100" id="name" type="text" name="name" placeholder="Your Name" required>
</div>
<div class="wrap-input100 validate-input" data-validate="Phone is required">
<input class="input100" id="phone" type="number" name="phone" placeholder="Your Number" required>
</div>
<div class="wrap-input100 validate-input">
<select name="course" class="input100 label-input100" style="background: #fff;color: #909090;outline:0;" required>
<option value="">Choose Your Course</option>
<option value="NOT DECIDED">NOT DECIDED</option>
<option value="DIPLOMA IN ADVANCE SERVICE MANAGEMENT">DIPLOMA IN ADVANCE SERVICE MANAGEMENT</option>
<option value="DIPLOMA IN CABIN CREW TRAINING">DIPLOMA IN CABIN CREW TRAINING</option>
<option value="DIPLOMA IN AIRPORT & TRAVEL MANAGEMENT">DIPLOMA IN AIRPORT & TRAVEL MANAGEMENT</option>
<option value="DIPLOMA IN HOTEL OPERATION & TRAVEL MANAGEMENT">DIPLOMA IN HOTEL OPERATION & TRAVEL MANAGEMENT</option>
</select>
</div>
<div class="container-contact100-form-btn pt3">
<div class="wrap-contact100-form-btn">
<div class="contact100-form-bgbtn"></div>
<input class="button center submit_btn" type="submit" value="SUBMIT" style="color: #fff;width: 90%;margin: 30px auto; display: block;">
</div>
</div>
</form>
Below mentioned code is my php code for the above form.
<?php
if(!empty($_POST)){
$email = "test@test.com";
$name = $_POST['name'];
$course = $_POST['course'];
$phone = $_POST['phone'];
$enquiry = $_POST['enquiry'];
$formcontent=" From: $name \n Phone: $phone \n Course: $course";
$recipient = "test@test.com";
$subject = 'KNOW YOUR DISCOUNTED FEES FORM FROM HOME PAGE';
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
$domain_url = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]";
header("Content-type: application/json");
header("Access-Control-Allow-Credentials: true");
// header("Access-Control-Allow-Headers:Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token");
// header("Access-Control-Allow-Methods:POST, GET, OPTIONS");
header("Access-Control-Allow-Origin: ". str_replace('.', '-','http://fleapo.co/apt/') .".cdn.ampproject.org");
header("AMP-Access-Control-Allow-Source-Origin: " . $domain_url);
header("Access-Control-Expose-Headers: AMP-Access-Control-Allow-Source-Origin");
header("AMP-Redirect-To: https://www.aptadvantage.com");
header("Access-Control-Expose-Headers: AMP-Access-Control-Allow-Source-Origin, AMP-Redirect-To");
header('Location: https://www.aptadvantage.com');
echo json_encode(array('name' => $name));
exit;
}
?>
The basic issue which I am facing is that on submitting the form the page should redirect to another page which doesn't happen. I want my form on submit to be redirected to another page but instead the page remains as it is. I am recieving the details which have been entered in the form. The code which was required to redirect the page to another page is already present but still it doesn't work. Any help from anyone of the members will be very fruitful to me. Thanks for reading til the end. Thanks for advance for any suggestions from your side.