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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    May 2011
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Need help with returning fields from form

    Hi, My form currently submits to email but it is not returning the dog name and the coupon name. Code below. live example at www.localadsaver.com/contest.php


    Code:
    <form action="contestmailer.php" method="post" id="contactform">
              <ol>
                <li>
                  <label for="name">Full Name <span class="red">(required)</span></label>
                  <input id="name" name="name" class="text" />
                </li>
                <li>
                  <label for="email">Your email <span class="red">(required)</span></label>
                  <input id="email" name="email" class="text" />
                </li>
                <li>
                  <label for="coupon">Coupon Name <span class="red">(required)</span></label>
                  <input id="coupon" name="coupon" class="text" />
                </li>
                <li>
                  <label for="dog">Dog Name <span class="red">(required)</span></label>
                  <input id="dog" name="dog" class="text" />
                </li>
             
                <li class="buttons">
                  <input type="image" name="imageField" id="imageField" src="images/send.gif" class="send" />



    PHP Code:
    <?php

    if(!$_POST) exit;

    $email $_POST['email'];
    $name $_POST['name'];
    $coupon $_POST['coupon'];
    $dog $_POST['dog'];


    //$error[] = preg_match('/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i', $_POST['email']) ? '' : 'INVALID EMAIL ADDRESS';
    if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email )){
        
    $error.="Invalid email address entered";
        
    $errors=1;
    }
    if(
    $errors==1) echo $error;
    else{
        
    $values = array ('name','email','coupon','dog');
        
    $required = array('name','email','coupon','dog');
         
        
    $your_email "advertise@localadsaver.com";
        
    $email_subject "June Contest Entry: ";
        
    $email_content "Contest Entry:\n Name:$name\n Email:$email\n Coupon Name:$coupon\n Dog Name:$dog\n";
        
        foreach(
    $values as $key => $value){
          if(
    in_array($value,$required)){
            
              if( empty(
    $_POST[$value]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; }
            }
            
    $email_content .= $value.': '.$_POST[$value]."\n";
          }
        }
         
        if(@
    mail($your_email,$email_subject,$email_content)) {
            echo 
    'Message sent!'
        } else {
            echo 
    'ERROR!';
        }

    ?>

  • #2
    New to the CF scene
    Join Date
    May 2011
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts
    plz help


  •  

    Posting Permissions

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