Kineas
11-01-2009, 09:59 AM
I'm trying to make a contact form that will e-mail me what the user has input. My code all seems to work fine, but then I never receive an e-mail. This is what I've got so far. I am hosting it on a webserver when trying it, and I have put my actual e-mail address in the code, I just took it out so no one would see it on here, in case someone was gonna say that's why it's not working lol.
contact.php
<form method="POST" action="mailer.php">
Name<BR>
<input type="text" name="name" size="19"><br>
<BR><BR>
E-Mail<BR>
<input type="text" name="email" size="19"><br>
<BR><BR>
Message<BR>
<textarea rows="9" name="message" cols="30"></textarea>
<BR>
<BR>
<input type="submit" value="Submit" name="submit">
</form>
mailer.php
<?php
if(isset($_POST['submit'])) {
$to = "me@me.com";
$subject = "Form Tutorial";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];
$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message";
echo "Data has been submitted to $to!";
mail($to, $subject, $body);
} else {
echo "blarg!";
}
?>
contact.php
<form method="POST" action="mailer.php">
Name<BR>
<input type="text" name="name" size="19"><br>
<BR><BR>
E-Mail<BR>
<input type="text" name="email" size="19"><br>
<BR><BR>
Message<BR>
<textarea rows="9" name="message" cols="30"></textarea>
<BR>
<BR>
<input type="submit" value="Submit" name="submit">
</form>
mailer.php
<?php
if(isset($_POST['submit'])) {
$to = "me@me.com";
$subject = "Form Tutorial";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];
$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message";
echo "Data has been submitted to $to!";
mail($to, $subject, $body);
} else {
echo "blarg!";
}
?>