I tried many sites but I can't find the result of what I want to do. so anybody can please help me to solve this? My problem is this code belongs PHPMailer library. how I redirect to the homepage after the email submission. My home page is index.html
<?php
use PHPMailer\PHPMailer\PHPMailer;
if(isset($_POST['name']) && isset($_POST['email'])){
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$body = $_POST['body'];
require_once "PHPMailer/PHPMailer.php";
require_once "PHPMailer/SMTP.php";
require_once "PHPMailer/Exception.php";
$mail = new PHPMailer();
//smtp settings
$mail->isSMTP();
$mail->Host = "smtp.gmail.com";
$mail->SMTPAuth = true;
$mail->Username = "website@gmail.com";
$mail->Password = '123';
$mail->Port = 465;
$mail->SMTPSecure = "ssl";
//email settings
$mail->isHTML(true);
$mail->setFrom($email, $name);
$mail->addAddress("website@gmail.com");
$mail->Subject = ("$email ($subject)");
$mail->Body = $body;
$mail->send();
}
?>