Hi everyone, I am very new and very pleased with blue voda and myself !but seem to be having one problem; when I try to send myself an e-mail the error page flashes up with 'it seems you have forgot to fill in your name, please go back' but I did fill in my name. does anyone know what's wrong. Thanks www.arnabaartz.com
contact form, coming up error
Collapse
X
-
Re: contact form, coming up error
the contact page url is http://www.arnabaartz.com/contact
Not sure if what i have pasted here is the php code.
<?php
$name = $HTTP_POST_VARS['name'];
$email = $HTTP_POST_VARS['email'];
$comments = $HTTP_POST_VARS['comments'];
if (strlen($name) == 0)
{
echo "It appears that you have forgot to fill in your name in the Name field. Please use the Back Button to return to the form and enter your name. Thank you!";
exit;
}
if (strlen($name) >=30)
{
echo "The length limit for the Name field cannot exceed 30 characters / spaces. Please use the Back Button to return to the form and shorten this entry. Thank you!";
exit;
}
if (strlen($email) == 0)
{
echo "The E-mail field is a required entry. Please use the Back Button to return to the form and enter a contact E-mail address. Thank you!";
exit;
}
if (strlen($email) >= 45)
{
echo "The length limit for the E-Mail field cannot exceed 45 characters / spaces. Please use the Back Button to return to the form and shorten this entry. Thank you!";
exit;
}
if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $email))
{
echo "I believe that there is an error in the way you entered your E-mail address. Please check your entry and re-submit. Thank you!";
exit;
}
if (strlen($comments) >= 300)
{
echo "The comments area is limited to 300 characters / spaces. It appears that you have exceeded that limit. Please use the back button to return to the form and shorten this entry.Thank you!";
exit;
}
if (substr_count($comments , '@') > "2")
{
echo "For security reasons this text (comments) area limits the number of @ symbols that can appear within it. It would appear that you have exceeded that number. Please use the Back Button to return to the form and correct this. Thank you for your patience!";
exit;
}
//SEND MAIL
$mailto = "arnabaartz8******.com.au";
$mailsubj = "note to Arna";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "submission from:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS))
{
$mailbody .= "$key : $val\n";
}
mail($mailto,$mailsubj,$mailbody,$mailhead);
echo "Thank you for visiting my site and filling out my form. I will get back to you very soon!";
?>
Comment
-
-
Re: contact form, coming up error
Ok- a quick look shows that the fields in your form are named-
Name
E-mail
comments
and the variables in the php script are:
name
email
comments
Both must match. I suggest that you change the form field names to match the variables in the script (name, email, comments)
The reason for the error- The field validation looks at the script and finds no matching value for name- it therefore assumes you left it empty.
Let us know how that works out.
AndyPHP- is a blast!
Comment
-
Comment