I have been trying to add form submit to my web form, so that it submits data to my email using POST. So far this is what I have and it works perfectly:
<?php
if(isset($_POST['submit'])){
$user = $_POST['user'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$to = "your-webmail here";
$subject = "Applied Data";
$txt = "Name-'.$user.',<br>Phone -'.$phone.',<br>Email-'.$email.'";
$headers = "From: your@gmail.com" . "\r\n" .
$headers .= 'Cc: your@gmail.com' . "\r\n";
$ab=(mail($to,$subject,$txt,$headers));
if($ab)
{
echo"<script>alert('SignUp successfully.')</script>";
echo "<script>window.open('index.php','_self')</script>";
}
else
{
echo"Failed";
}
}
?>
Is there a way to add a redirect to this code, so it redirects after form is submitted?