Hi all,
I made this form using Pablo's way:
and the acknowledge php page:
Everything works fine.
Now i wanted to validate required fields and made 3 more errors pages:
And try this script, using navaldesign's way:
<?php
@$Name = addslashes($_POST['Name']);
@$Email = addslashes($_POST['Email']);
@$Essay = addslashes($_POST['Essay']);
if (strlen($Name) >40)
{
header("Location: error_name.html");
exit;
}
if (strlen($Name) == 0 )
{
header("Location: error_name.html");
exit;
}
if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $Email))
{
header("Location: error_email.html");
exit;
}
if (strlen($Email) == 0 )
{
header("Location: error_email.html");
exit;
}
if (strlen($Essay) == 0 )
{
header("Location: error_essay.html");
exit;
}
$pfw_header = "From: $Email\n"
. "Reply-To: $Email\n";
$pfw_subject = "Data Submitted from Webform";
$pfw_email_to = "duyanhvq@nguyenthaihocfoundation.com";
$pfw_message = "Name: $Name\n"
. "Email: $Email\n"
. "Essay: $Essay\n"
*****($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;
header("Location: ack.php");
?>
I put the script inside body tag of ack.php and replaced the former one.
It didn't work and got the message:
Parse error: parse error, unexpected '@' in /home/nguyent/public_html/ack.php on line 60
What did i do wrong? Please help. Thank you so much.
Quy
I made this form using Pablo's way:
and the acknowledge php page:
Everything works fine.
Now i wanted to validate required fields and made 3 more errors pages:
And try this script, using navaldesign's way:
<?php
@$Name = addslashes($_POST['Name']);
@$Email = addslashes($_POST['Email']);
@$Essay = addslashes($_POST['Essay']);
if (strlen($Name) >40)
{
header("Location: error_name.html");
exit;
}
if (strlen($Name) == 0 )
{
header("Location: error_name.html");
exit;
}
if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $Email))
{
header("Location: error_email.html");
exit;
}
if (strlen($Email) == 0 )
{
header("Location: error_email.html");
exit;
}
if (strlen($Essay) == 0 )
{
header("Location: error_essay.html");
exit;
}
$pfw_header = "From: $Email\n"
. "Reply-To: $Email\n";
$pfw_subject = "Data Submitted from Webform";
$pfw_email_to = "duyanhvq@nguyenthaihocfoundation.com";
$pfw_message = "Name: $Name\n"
. "Email: $Email\n"
. "Essay: $Essay\n"
*****($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;
header("Location: ack.php");
?>
I put the script inside body tag of ack.php and replaced the former one.
It didn't work and got the message:
Parse error: parse error, unexpected '@' in /home/nguyent/public_html/ack.php on line 60
What did i do wrong? Please help. Thank you so much.
Quy
Comment