0

I know there are similar people that posted contact form help but I have an issue with mine. Everything works but when I submit I get an e-mail from apache that shows a blank message. However, when I use my own e-mail address in the form input , it works.

Here is my code

<?php 
if(isset($_POST['submit'])){}
$name = $_POST['name'];
$email = $_POST['email'];
$minrooms=$_POST['mrooms'];
$message = $_POST['comment'];
$formcontent="From: $name \n Email: $email \n Min Number of Rooms: $minrooms\n Message: $message ";
$recipient = "kellito13@gmail.com";
$subject = "Contact Form";
$mailHeader = "From: $email \r\n";
send_contact= mail($recipient, $subject, $formcontent, $mailHeader) or die("Error!");
echo "Thank You!";
}
else{
    echo"Error";
}
?>
alexander.polomodov
  • 5,396
  • 14
  • 39
  • 46
user3261680
  • 91
  • 2
  • 11
  • 1
    "Don't show anything" = there is an error. When debugging, you have to [→activate error reporting](http://stackoverflow.com/questions/1053424/how-do-i-get-php-errors-to-display). `send_contact` what is? Also `{}` sounds a bit strange. – fusion3k Mar 13 '16 at 22:31

1 Answers1

0

You have syntax errors in your code with {} and send_contact= mail($recipient, $subject, $formcontent, $mailHeader) or die("Error!");.

It should be something like this:

<?php
if(isset($_POST['submit'])){
    $name = $_POST['name'];
    $email = $_POST['email'];
    $minrooms=$_POST['mrooms'];
    $message = $_POST['comment'];
    $formcontent="From: $name \n Email: $email \n Min Number of Rooms: $minrooms\n Message: $message ";
    $recipient = "kellito13@gmail.com";
    $subject = "Contact Form";
    $mailHeader = "From: $email \r\n";
    $send_contact= mail($recipient, $subject, $formcontent, $mailHeader) or die("Error!");
    echo "Thank You!";
}
else{
    echo"Error";
}
?>
alexander.polomodov
  • 5,396
  • 14
  • 39
  • 46