Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Dec 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    form sending balnk emails after validation, any fixes?

    Hey,

    I have a couple of forms which use JS validation and if the validation checks out the forms action is a new php page which sends the form (see code below). It all works fine but occasionally blank emails come through. After researching some people say I shouldn't use client side validation. Is there an easier way by tweaking the code I have rather than changing it all completely?

    Code:
    <script language="php">
    $email = $HTTP_POST_VARS[email];
    $mailto = "info@xxxxxxxx.com";
    $mailsubj = "mail form";
    $mailhead = "From: $Email\n\n";
    reset ($HTTP_POST_VARS);
    $mailbody = "mail:\n\n";
    
    while (list ($key, $val) = each ($HTTP_POST_VARS)) { $mailbody .= "$key : $val\n"; }
    if (!eregi("\n",$HTTP_POST_VARS[email])) { mail($mailto, $mailsubj, $mailbody, $mailhead); }
    </script>

    thanks for any help,

    E

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,866
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Code:
    <script language="php">
    There's no such thing! Know what's PHP from http://www.php.net/manual/en/intro-whatis.php
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New to the CF scene
    Join Date
    Dec 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the reply, it works despite that bit of code not existing, are you saying that if i put it as the below it will stop the blank emails? I fail don't see how it would...

    Code:
    <?php
    $email = $HTTP_POST_VARS[email];
    $mailto = "info@xxxxxxxx.com";
    $mailsubj = "mail form";
    $mailhead = "From: $Email\n\n";
    reset ($HTTP_POST_VARS);
    $mailbody = "mail:\n\n";
    
    while (list ($key, $val) = each ($HTTP_POST_VARS)) { $mailbody .= "$key : $val\n"; }
    if (!eregi("\n",$HTTP_POST_VARS[email])) { mail($mailto, $mailsubj, $mailbody, $mailhead); }
    ?>


  •  

    Tags for this Thread

    Posting Permissions

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