Need help with sending mail in PHP
Posted: Sat Oct 25, 2003 4:38 am
Ive created a Contact form, with this code:
The form itselft is on another page, ill reply with the code for it if needed,
But when i test it, i get a Parse error saying:
Code: Select all
<?php
//Check for empty fields
if(isset($_POST['email'])) {
if($_POST['email'] <> "") {
if($_POST['subject'] <> "") {
if($_POST['message'] <> "") {
$to = "vigge19@hotmail.com";
$from = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$headers = "From: $from\r\n";
$success = mail($to, $subject, $message, $headers);
if($success) $msg = "The email was succesfully sent.";
else $msg = "An error occurred when sending the email.";
//If the user have forgot a needed field, tell him:
} else { $msg = "You need to have a message!" };
} else { $msg = "You forgot the subject field" };
} else { $msg = "You must fill in the email field" };
};
//Print back button and content of page and message:
echo "$msg<br>
<input type="button" value=" back to about page " onClick="history.go(-2)">
";
?>But when i test it, i get a Parse error saying:
What have i done wrong?Parse error: parse error, unexpected '}' in C:\xampp\htdocs\source\mail.php on line 22