-i get this error:
Parse error: syntax error, unexpected T_STRING in D:\hosting\3093430\html\thankyou.php on line 21
code:
<?php
$to = "divorcemill@divorcemill.com"; // change to your email address
$name = $_POST['name'];
$email = $_POST['email'];
$yes1 = $_POST['yes1'];
$No1 = $_POST['No1'];
$yes = $_POST['yes'];
$No = $_POST['No'];
$d = date('l dS \of F Y h:i:s A');
$sub = "form to mail";
$headers = "From: $name <$email>\n";
$headers .= "Content-Type: text/plain; charset=iso-8859-1\n";
$mes = "Yes1: ".$Yes1."\n";
$mes .= "No1: ".$No1."\n";
$mes = "Yes: ".$Yes."\n";
$mes = "No: ".$No."\n";
$mes .= "Name: ".$name."\n";
$mes .= 'Email: '.$email."\n";
$mes .= 'Date & Time: '.$d;
if (empty($name) 娄娄 empty($email) 娄娄 empty($Yes1) 娄娄 empty($No1)) 娄娄 empty($Yes) 娄娄 empty($No))
{
{
// Empty form field
// redirect back to the form
header("Location: http://www.divorcemill.com/Get Started.html");
exit();
}
elseif(!ereg("^[_a-z0-9-]+(\.[_a-z0-9-鈥?$email)) {
// Invalid email address
// redirect back to the form
header("Location: http://www.divorcemill.com/Get Started.html");
exit();
}
else
{
// Success
mail($to, $sub, $mes, $headers);
header("Location: http://www.widgets.com/");
exit();
}
?>Several small syntax mistakes:
- "$yes" is not equal to "$Yes" etc... (case sensitive)
- Your "if" is not correct: if ( (cond) || (cond) || (cond) ) => backets areound EACH condition
- Your ereg has no closing quotes...
And it is a very sloppy coding...count your braces in your if elseif statements.
没有评论:
发表评论