Thank you very much for your reply.
I've made some changes, but still getting nothing in return and I'm not sure how to use the Meta... I thought that would go in the head tag, but if it did then wouldn't that override the php as head tag is called first? I'm sorry, I am a complete noob.
Although I have read through the w3schools tutorial and understand Java, HTML, CSS, Javascript etc. I'm just not very good with them.
Anywho:
<form method="post" action="contact.php" align="center">
My Email Address: <br><input name="email" type="text" size="60"><br><br>
Message:<br>
<textarea name="message" rows="15" cols="60"></textarea><br>
<input type="submit">
</form>
The form uses the post method and posts data to contact.php using the email and message fields.
<?php
$email = $_POST["email"];
$message = $_POST["message"];
$to = "___@gmail.com";
$subject = "Contact Us";
$headers = "From: $email";
mail($to, $subject, $message, $headers) ;
if (!headers_sent()) {
header('Location: thankyou.html');
exit;
}
if (!headers_sent($filename, $linenum)) {
header('Location: thankyou.html');
exit;
}
else {
echo "Headers already sent in $filename on line $linenum\n" .
"Cannot redirect, for now please click this <a " .
"thankyou.html\">link</a> instead\n";
exit;
}
?>
contact.php collects the forms email and message fields and uses the mail function to send the email. If no headers are sent then use the header function to send user to thankyou.html. Else, ask the user to redirect themselves.
I am struggling. I don't know why it won't work and it isn't like I have a compiler like when I used to do JAVA and it could tell me otherwise. Am I making some stupid mistake? When I click send I just see the php file in my browser 😕