Parse error: syntax error, unexpected ':' in /home2/geckohos/public_html/contact-form-handler.php on line 30
Printable View
Parse error: syntax error, unexpected ':' in /home2/geckohos/public_html/contact-form-handler.php on line 30
Post your contact-form-handler.php
PHP Code:<?php
$errors = '';
if(empty($_POST['name']) ||
empty($_POST['email']) ||
empty($_POST['message']))
{
$errors .= "\n Error: all fields are required";
}
$name = $_POST['name'];
$email_address = $_POST['email'];
$message = "Hello, i am sending this email to you because i think you would like to play InfusionWoW which is like World of Warcraft, but better. We are looking for constant players who are dedicated to the game and are instrested in WoW. I look forward to seeing you in-game, thanks! bye.";
$myemail = $_POST['rec'];
if (!eregi(
"^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$",
$email_address))
{
$errors .= "\n Error: Invalid email address";
}
if( empty($errors))
{
$to = $myemail;
$email_subject = "Contact form submission: $name";
$email_body = "You have received a new message. ".
" Here are the details:\n Name: $name \n Email: $email_address \n Message \n $message";
$headers = "From: $myemail";
$headers .= " Invitation ": $email_address";
mail($to,$email_subject,$email_body,$headers);
//redirect to the 'thank you' page
header('Location: contact-form-thank-you.html');
}
<html>
<head>
<title>Contact form handler</title>
</head>
<body>
<!-- This page is displayed only if there is some error -->
<?php
echo nl2br($errors);
?>
</body>
</html>
Edit: Whoops, it needs to be
PHP Code:<?php
$errors = '';
if(empty($_POST['name']) ||
empty($_POST['email']))
{
$errors .= "\n Error: all fields are required";
}
$name = $_POST['name'];
$email_address = $_POST['email'];
$message = "Hello, i am sending this email to you because i think you would like to play InfusionWoW which is like World of Warcraft, but better. We are looking for constant players who are dedicated to the game and are instrested in WoW. I look forward to seeing you in-game, thanks! bye.";
$myemail = $_POST['rec'];
if (!eregi(
"^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$",
$email_address))
{
$errors .= "\n Error: Invalid email address";
}
if( empty($errors))
{
$to = $myemail;
$email_subject = "Contact form submission: $name";
$email_body = "You have received a new message. ".
" Here are the details:\n Name: $name \n Email: $email_address \n Message \n $message";
$headers = "From: $myemail";
$headers .= " Invitation : $email_address";
mail($to,$email_subject,$email_body,$headers);
//redirect to the 'thank you' page
header('Location: contact-form-thank-you.html');
} ?>
<html>
<head>
<title>Contact form handler</title>
</head>
<body>
<!-- This page is displayed only if there is some error -->
<?php
echo nl2br($errors);
?>
</body>
</html>
---------- Post added at 09:17 PM ---------- Previous post was at 09:04 PM ----------
My bad D: There was another file you needed
scripts.rar
use that so you have a folder named scripts next to the contact files (now it should pop up saying you forgot a field/invalid etc)
Error: all fields are required, i have filled them all in :S
nvm fixed.
Ok ignore all of ^^^^ and use this
Contact Form (all of it).zip
It all works perfectly on mine (It has all the stuff you added)
Edit: NVM then xD