Need help with a PHP contact form!
Moderator: General Moderators
Re: Need help with a PHP contact form!
That confirms that mail() is failing. I'd open a ticket with your hosting provider.
Re: Need help with a PHP contact form!
Ok after i did it properly i am getting a 500 server error. It says the resource i am looking for cannot be displayed?
Re: Need help with a PHP contact form!
After you did what properly? What do you mean?
Re: Need help with a PHP contact form!
I placed the code in the wrong place
Re: Need help with a PHP contact form!
Post the code that resulted in the 500 error?
Re: Need help with a PHP contact form!
Code: Select all
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$from = 'From: ashfordhales';
$to = 'ashfordhales@gmail.com';
$subject = 'Inquiry';
$body = "From: $name\n E-Mail: $email\n Message:\n $message";
if ($_POST['submit']) {
if (mail ($to, $subject, $body, $from)) {
echo '<p>Your message has been sent!</p>';
} else {
echo '<p>Something went wrong, go back and try again!</p>';
}
$success = mail($ashfordhales@gmail.com, 'Test', 'Test Message');
var_dump($success);
}
?>Re: Need help with a PHP contact form!
Code: Select all
$success = mail($ashfordhales@gmail.com, 'Test', 'Test Message');Let's take the form out of the equation for a minute. Create a new PHP file containing ONLY the two lines I listed earlier, and check the results of that.
Re: Need help with a PHP contact form!
Now it replies bool(false)
Re: Need help with a PHP contact form!
If mail() is returning FALSE, open a ticket with your hosting provider.
Re: Need help with a PHP contact form!
Whats a ticket? and how do i do this?
Re: Need help with a PHP contact form!
Does anybody know how to do this?
Re: Need help with a PHP contact form!
Contact your hosting provider and complain that mail() isn't working.