Hey guys
I'm sitting here wondering wheather this php contact form solution is too simple to actually work. Or, well it does work, but will it always work?
Also, atm when you recieve the email, it says FROM: [email protected] which means that most mail clients will put it straight in the junkbox. How can I change it to the entered email address?
Thanks!
<form method="POST" action="mailer.php">
<input type="text" name="name" size="19">
<input type="text" name="phone" size="19">
<input type="submit" value="Submit" name="submit">
</form>
<?php
if(isset($_POST['submit'])) {
$to = "[email protected]";
$subject = "From website";
$name_field = $_POST['name'];
$phone_field = $_POST['phone'];
$body = "From: $name_field\n E-Mail: $phone_field\n";
echo "Data has been submitted to $to!";
mail($to, $subject, $body);
} else {
echo "Error!";
}
?>