Contact Form returns 500 Internal Server Error

I’m a beginner at PHP but I had to make a contact form for a website.

Here is my PHP

[php]

<?php $name = $_POST['name']; $email = $_POST['email']; $text = $_POST['text'] $from = "From: Website "; $to = '[email protected]'; $subject = 'Message'; $body = "From: $name\n Email: $email\n Message:\n $text"; ?> <?php if ($_POST['submit']) { if (mail ($to, $subject, $body, $from)) { echo '

Your message has been sent!

'; } else { echo '

Something went wrong, go back and try again!

'; } } [/php] Here is the HTML [code]

[/code]

A 500 code is the hardest thing to diagnose, due to it being the catchall error.

Some things to check,
Owner of the file
File permissions, (644 for instance)
Proper group for the file

Just about anything could be wrong, and I have had a few double takes for the reasons causing it on several web applications.

[php]

<?php if ($_POST['submit']) { $name = $_POST['name']; $email = $_POST['email']; $text = $_POST['text'] $from = "From: Website "; $to = '[email protected]'; $subject = 'Message'; $body = "From: $name\n Email: $email\n Message:\n $text"; if (mail ($to, $subject, $body, $from)) { echo '

Your message has been sent!

'; } else { echo '

Something went wrong, go back and try again!

'; } } [/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service