I have created simple form using name,email,comments and i created seperate web pages as
name_error.html,email_error.html,comments_error,co nfirmationpage.html
The code inserted in processingpage.php as
<?PHP
// Receiving variables
@$name = addslashes($_POST['name']);
@$email = addslashes($_POST['email']);
@$comments = addslashes($_POST['comments']);
// error checking
if (strlen($name) == 0 )
{
header("Location: name_error.html");
exit;
}
if (strlen($email) == 0 )
{
header("Location: email_error.html");
exit;
}
if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $email))
{
header("Location: email_error.html");
exit;
}
if (substr_count($comments, '@') > "2")
{
header("Location: comments_error.html");
exit;
}
//Sending Email to form owner
$mailto = "sunny152s@rediffmail.com";
$mailsubj = "FEEDBACK";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Values from my website form:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS))
{
if ($key!="submit")
{
$mailbody .= "$key : $val\n";
}
}
mail($mailto, $mailsubj, $mailbody, $mailhead);
// Autoresponder
$mailto = $email;
$mailsubj = "Copy of the info you Submitted";
$mailhead = "From: website form\n";
mail($mailto, $mailsubj, $mailbody, $mailhead);
header("Location: confirmationpage.html");
?>
Now,the email error,name error and comments error messages are working well but when the visitor types his name,email,comments and press submit button,then the error message getting is
PHP Warning: reset() [function.reset]: Passed variable is not an array or object in H:\Websites\LocalUser\wesleychurch\processingpage. php on line 31 PHP Warning: Variable passed to each() is not an array or object in H:\Websites\LocalUser\wesleychurch\processingpage. php on line 33 PHP Warning: mail() [function.mail]: SMTP server response: 551 This mail server requires authentication before sending mail from a locally hosted domain. Please reconfigure your mail client to authenticate before sending mail. in H:\Websites\LocalUser\wesleychurch\processingpage. php on line 40 PHP Warning: mail() [function.mail]: SMTP server response: 551 This mail server requires authentication before sending mail from a locally hosted domain. Please reconfigure your mail client to authenticate before sending mail. in H:\Websites\LocalUser\wesleychurch\processingpage. php on line 45
Please help.
Thanks,
Sunny
name_error.html,email_error.html,comments_error,co nfirmationpage.html
The code inserted in processingpage.php as
<?PHP
// Receiving variables
@$name = addslashes($_POST['name']);
@$email = addslashes($_POST['email']);
@$comments = addslashes($_POST['comments']);
// error checking
if (strlen($name) == 0 )
{
header("Location: name_error.html");
exit;
}
if (strlen($email) == 0 )
{
header("Location: email_error.html");
exit;
}
if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $email))
{
header("Location: email_error.html");
exit;
}
if (substr_count($comments, '@') > "2")
{
header("Location: comments_error.html");
exit;
}
//Sending Email to form owner
$mailto = "sunny152s@rediffmail.com";
$mailsubj = "FEEDBACK";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Values from my website form:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS))
{
if ($key!="submit")
{
$mailbody .= "$key : $val\n";
}
}
mail($mailto, $mailsubj, $mailbody, $mailhead);
// Autoresponder
$mailto = $email;
$mailsubj = "Copy of the info you Submitted";
$mailhead = "From: website form\n";
mail($mailto, $mailsubj, $mailbody, $mailhead);
header("Location: confirmationpage.html");
?>
Now,the email error,name error and comments error messages are working well but when the visitor types his name,email,comments and press submit button,then the error message getting is
PHP Warning: reset() [function.reset]: Passed variable is not an array or object in H:\Websites\LocalUser\wesleychurch\processingpage. php on line 31 PHP Warning: Variable passed to each() is not an array or object in H:\Websites\LocalUser\wesleychurch\processingpage. php on line 33 PHP Warning: mail() [function.mail]: SMTP server response: 551 This mail server requires authentication before sending mail from a locally hosted domain. Please reconfigure your mail client to authenticate before sending mail. in H:\Websites\LocalUser\wesleychurch\processingpage. php on line 40 PHP Warning: mail() [function.mail]: SMTP server response: 551 This mail server requires authentication before sending mail from a locally hosted domain. Please reconfigure your mail client to authenticate before sending mail. in H:\Websites\LocalUser\wesleychurch\processingpage. php on line 45
Please help.
Thanks,
Sunny
Comment