Get rid of reCaptcha fields in emails

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • KHurst
    New Member
    • Apr 2008
    • 4

    Get rid of reCaptcha fields in emails

    How do I get rid of reCaptcha fields that are emailed when I submit a form? I guess what I am asking is how do you exclude unwanted fields from being posted to email from a form in PHP?

    Thanks,
    Kenny
  • TheServant
    Recognized Expert Top Contributor
    • Feb 2008
    • 1168

    #2
    Had to look up reCaptchas, I thought they were the same as Captchas! Anyway, Do you have the form code etc? It sounds like it's not your form and you're trying to bypass some information sending. My apologies if I'm wrong.

    But give up some code to work with and we can help! Just remember to follow the posting guidlines and use the correct code tags for your code.

    Comment

    • KHurst
      New Member
      • Apr 2008
      • 4

      #3
      This the code I use to build my email message body:

      [PHP]//Build Message Body from Contact Form
      foreach ($_POST as $Field=>$Value)
      //Check for NOT Empty Fields
      if(!empty($Valu e)) {
      $MsgBody .= "$Field: $Value\n";
      }[/PHP]




      This is the body content of the sent email. At the bottom are the reCaptcha fields that I do not want to send:

      First_Name: John
      Last_Name: Doe
      Gender: Male
      Street_Address: 100 Main St.
      City: Hometown
      State: DC
      Zipcode: 12345
      Address_Private : Yes
      Birthday: 07-04
      recaptcha_chall enge_field: 024rRIIuoLSg5yo YQ1gh-loK6u9JgTum-hvx34oRZcFbFBOG YjVWksaPIU_0NF1 WedQGckwvgmZO2u BUVlwjoSWZQxuuH zaJebbTYjyKesJu dQZ75_2f2X_HkSr Jsrq8cF8d4gYE-l1G--pQynj-zqMgAnOw2OhMzzQ xiiVyLN5vVl98dj vDFrvJDNgas26Kf 4T-hlHwIC
      recaptcha_respo nse_field: unemployedto

      Comment

      • ronverdonk
        Recognized Expert Specialist
        • Jul 2006
        • 4259

        #4
        Set the key names you want to exclude in an array and check the existence of each key in that array. So when a key is not in that array and the value is not empty, then construct the message, i.e.[php]$Excludes=array ('recaptcha_cha llenge_field',' recaptcha_respo nse_field');
        //Build Message Body from Contact Form
        foreach ($_POST as $Field=>$Value) {
        //Check for allowed and NOT Empty Fields
        if(!in_array($F ield, $Excludes) AND !empty($Value)) {
        $MsgBody .= "$Field: $Value\n";
        }
        }[/php]Ronald

        Comment

        Working...