Need some help here.

A little curious why this form isn't going to my e-mail?

<?php if(isset($_POST['submit'])) {

$to = ""; $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!";

} ?>

That's the code I have for my mailer.php. It's taken right off an online tutorial, and looking through I can't figure out why it isn't working. Any ideas? thanks!

  • Isn't this off-topic? Bobby Jack almost 8 years ago
  • Thanks for this. Either you can comment and help me out, or kindly move along. This forum is aimed at HTML, CSS, and 'web design' questions - as such I'm not entirely sure this question is off-topic. KyleBooth almost 8 years ago

1 answer


Apart from a couple of typos where $POST should be $_POST it all works fine just as is for me.

what errors do you get in your server error log? is PHP enabled? where are you testing it?

Answered almost 8 years ago by Tony Crockford
  • Thank you for your help... at least now I can confirm that it's likely an issue with the server. KyleBooth almost 8 years ago