+ Reply to Thread
Results 1 to 12 of 12

Thread: Form not working
      
   

  1. #1
    sunny152 is offline Sergeant First Class
    Join Date
    Jan 2007
    Posts
    52

    Default Form not working

    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
    Last edited by sunny152; 01-04-2008 at 06:45 PM. Reason: typing mistake

  2. #2
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,061

    Default Re: Form not working

    Hm...

    You have two problems.

    1. Seems like your php version doesn't recognoze the $HTTP_POST_VARS as an array. Try replacing it with $_REQUEST . Which version of php do you run ?

    2. The second is a bigger problem (maybe). Your server (local computer?) is set to require SMTP authentication. The only way to overcome this is to use a specific script that supports SMTP authentication, like php mailer or Zend Mailer. If you don't have coding experience, this might prove a bit problematic.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  3. #3
    sunny152 is offline Sergeant First Class
    Join Date
    Jan 2007
    Posts
    52

    Default Re: Form not working

    I tried replacing the code,but still not working.Any solution to this problem?
    Sunny

  4. #4
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,061

    Default Re: Form not working

    Is this a published webpage ? or are you running it locally in your computer ?

    If published, please provide a link.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  5. #5
    sunny152 is offline Sergeant First Class
    Join Date
    Jan 2007
    Posts
    52

    Default Re: Form not working

    Here is the link,

    http://wesleychurch.witnesstoday.org

    The modified PHP code is

    <?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 ($_REQUEST ))
    {
    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");
    ?>

  6. #6
    Watdaflip's Avatar
    Watdaflip is offline Major General
    Join Date
    Sep 2005
    Location
    Cincinnati, Ohio
    Posts
    2,119

    Default Re: Form not working

    Naval was saying to replace $HTTP_POST_VARS in this line

    reset ($HTTP_POST_VARS);

    Not in this line

    while (list ($key, $val) = each ($HTTP_POST_VARS))

    Anyway, are the variables being posted, the only reason I can think of that it would toss up that error is if nothing was posted and it was just empty, but even then it still should have had the array defined.

    Register/Login Script
    Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script

  7. #7
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,061

    Default Re: Form not working

    From what i see on your site, replacing $HTTP_POST_VARS in one line has solved part of the problem (You no longer have the second error message:

    PHP Warning: Variable passed to each() is not an array or object in H:\Websites\LocalUser\wesleychurch\processingpage. php on line 33

    So I suggest that you also do the same for the other line:

    reset ($_REQUEST); instead of reset ($HTTP_POST_VARS);


    However, even if this solves this part, the main problem, that of the SMTP authentication still remains and i believe that it will be your main problem.

    My only guess about the array problem is that you are running a particular php version that doesn't have (recognize) the $HTTP_POST_VARS global.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  8. #8
    sunny152 is offline Sergeant First Class
    Join Date
    Jan 2007
    Posts
    52

    Default Re: Form not working

    My server upgraded PHP from version 4.4.7 to 5.2.5.So can anybody please modify this PHP code to 5.2.5 version,Here is the PHP code-


    <?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 from my website form";
    $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");

  9. #9
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,061

    Default Re: Form not working

    This code SHOULD work with php v 5. If it doesn't then there is some further problem. Anyway, as i said, this script will NOT work in any case, because your hosting company requires SMTP authentication. Please read above, you will need a specialized script with a mailer class that provides SMTP authentication. If you can't make it this way, ask support from your hosting company, to provide you with instructions on how to use sendmail or any other script they have in cgi bin that provides this functionality.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  10. #10
    roadwarrior is offline Private
    Join Date
    Feb 2008
    Posts
    3

    Default Re: Form not working

    I have the same problem with the same hosting. I'm trying to use a e-mail form and a newsletter script and neither of them work, I always get the error:

    "PHP Warning: mail() [<a href='function.mail'>function.mail</a>]: 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:\Domains\DOMAIN\wwwroot\test\admin\SMLmailer.cla ss.php on line 165"

    Anyone knows how to fix it?

  11. #11
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,061

    Default Re: Form not working

    You need to use a SMTP supporting class. Try phpmailer . Google it.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  12. #12
    roadwarrior is offline Private
    Join Date
    Feb 2008
    Posts
    3

    Default Re: Form not working

    I dont understand some stuff in the installation (Im not a pro in this)

    this are the instructions:

    "Copy class.phpmailer.php into your php.ini include_path. If you are
    using the SMTP mailer then place class.smtp.php in your path as well.
    In the language directory you will find several files like
    phpmailer.lang-en.php. If you look right before the .php extension
    that there are two letters. These represent the language type of the
    translation file. For instance "en" is the English file and "br" is
    the Portuguese file. Chose the file that best fits with your language
    and place it in the PHP include path. If your language is English
    then you have nothing more to do. If it is a different language then
    you must point PHPMailer to the correct translation."

    where is (or what is) the php.ini include_path? cause its not in my wwwroot or anywhere inside of it.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49