Results 1 to 4 of 4

Thread: Form fails with empty email field
      
   

  1. #1
    GreatGretsky is offline Corporal
    Join Date
    Mar 2007
    Location
    Phoenix, AZ
    Posts
    12

    Default Form fails with empty email field

    I just discovered that my form fails when the user does not provide their e-mail address.

    When the user fills in the e-mail field, the form is delivered to my e-mail fine. When the e-mail field is left blank, the form simply never shows up.

    I discovered this quite by accident.

    I've now given the field an initial value of Your_Email@Here.com, which appears to solve the problem, although it looks silly.

    Is there any better solution??

    The domain is nowsavecash.com

    I'm using the following html in my action page:

    <BODY bgcolor="#FFFFFF" text="#000000" <?PHP
    $email = $HTTP_POST_VARS[email];
    $mailto = "jwolff@altusmortgage.net";
    $mailsubj = "Inquiry from NowSaveCash.com";
    $mailhead = "From: $email\n";
    reset ($HTTP_POST_VARS);
    $mailbody = "Values submitted from web site form :\n";
    while (list ($key, $val) = each ($HTTP_POST_VARS))
    {
    if ($key!="submit")
    {
    $mailbody .= "$key : $val\n";
    }
    }
    mail($mailto, $mailsubj, $mailbody, $mailhead);
    ?>

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

    Default Re: Form fails with empty email field

    Add

    if($email == "")
    $email = "default@default.com";
    // Change default@default.com to whatever you want it doesn't matter

    after

    $email = $HTTP_POST_VARS[email];

    hope that helps

    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

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

    Default Re: Form fails with empty email field

    If there is no email address entered in the form, the email gets blocked by the ISP's antispam filters. So the solution Watadaflip suggested will solve the problem Furthermore, i would suggest that you use your own email address as the default sender's address, converting the script as followes:

    <?PHP
    $mailto = "jwolff@altusmortgage.net";
    $email = $HTTP_POST_VARS[email];
    if ($email == "") {
    $email = $mailto;
    }
    $mailsubj = "Inquiry from NowSaveCash.com";
    $mailhead = "From: $email\n";
    reset ($HTTP_POST_VARS);
    $mailbody = "Values submitted from web site form :\n";
    while (list ($key, $val) = each ($HTTP_POST_VARS))
    {
    if ($key!="submit")
    {
    $mailbody .= "$key : $val\n";
    }
    }
    mail($mailto, $mailsubj, $mailbody, $mailhead);
    ?>
    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!


  4. #4
    GreatGretsky is offline Corporal
    Join Date
    Mar 2007
    Location
    Phoenix, AZ
    Posts
    12

    Default Re: Form fails with empty email field

    Thanks guys! Works like a charm!

    I discovered this problem completely by accident. Makes me wonder how many others are not getting forms delivered when users skip entering their e-mail addresses.

    Anyway, thanks for the quick reply.

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