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 4 of 4
  1. #1
    Regular Coder
    Join Date
    Mar 2007
    Posts
    157
    Thanks
    6
    Thanked 4 Times in 4 Posts

    Web form not passing POST data?

    Hi everyone! I have a contact form that I'm trying to add fields to, but for some reason the information that's added into them isn't passed to the PHP script and mailed to me. Or perhaps there's something in the script that's messing it up. I've been playing with this for hours and I can't figure it out. Any help would be greatly appreciated!

    At the top of my script I have some variables
    if(!$_POST) exit;

    PHP Code:
    $name     $_POST['name'];
            
    $email    $_POST['email'];
            
    $company   $_POST['company'];
            
    $streetaddress   $_POST['streetaddress'];
            
    $comments $_POST['comments'];
            
    $verify   $_POST['verify']; 
    For some reason it won't pick up the 'company' or 'streetaddress'.

    My form inputs for those:

    Code:
    <label for="company">Company:</label>
    <input name="company" type="text" id="company" size="30" value="" />
    
    <label for="streetaddress">Street Address:</label>
    <input name="streetaddress" type="text" id="streetaddress" size="30" value="" />
    Further down in the script it takes the data from the form and puts it into a nice message to be emailed.
    PHP Code:
    $e_reply "Name: $name\r\n\n";
    $e_email "Email Address: $email\r\n\n";
    $e_phone "Phone Number: $phone\r\n\n";
    $e_company "Company Name: $company\r\n\n";
    $e_address "Street Address: $streetaddress\r\n\n";

    $msg =  $e_reply $e_email $e_phone $e_company $e_address
    I think somewhere in one of those sections I'm screwing up. It will send the message part "Company Name:" but then it's blank, no matter what I do.

    Does anyone know what I'm doing wrong? Thank you for any help!

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    What does your form tag look like? Ya know you could just post the entire script, the problem is probably in an area you're not focusing on but we can't know this unless we see the whole thing.

  • #3
    Regular Coder
    Join Date
    Mar 2007
    Posts
    157
    Thanks
    6
    Thanked 4 Times in 4 Posts
    I was trying not to because it's a script I got on themeforest...Thank you for your help though!
    Code:
    <form method="post" action="sendout.php" name="contactform" id="contactform">
     <label for="name"><span class="required">*</span>Name:</label>
                <input name="name" type="text" id="name" size="30" value="" /> 
            
                <label for="email"><span class="required">*</span>Email Address:</label>
                <input name="email" type="text" id="email" size="30" value="" />
            
                <label for="company">Company:</label>
                <input name="company" type="text" id="company" size="30" value="" />
    			
                <label for="streetaddress">Street Address:</label>
                <input name="streetaddress" type="text" id="streetaddress" size="30" value="" />
            
    ...yada yada
    
    <input type="submit" class="submit" id="submit" value="Submit" />

    PHP Code:
    if(!$_POST) exit;
     
            
    $name     $_POST['name'];
            
    $email    $_POST['email'];
            
    $phone   $_POST['phone'];
            
    $company   $_POST['company'];
            
    $streetaddress   $_POST['streetaddress'];
            
    $city  $_POST['city'];
            
    $fax   $_POST['fax'];
            
    $comments $_POST['comments'];
            
    $verify   $_POST['verify'];

    ...
    yada yada

     $e_subject 
    'You\'ve been contacted by ' $name '.';

                        
             
    $e_body "You have been contacted by $name.  Their additional message is as follows.\r\n\n";
             
    $e_content "\"$comments\"\r\n\n";
             
    $e_reply "Name: $name\r\n\n";
             
    $e_email "Email Address: $email\r\n\n";
             
    $e_phone "Phone Number: $phone\r\n\n";
             
    $e_company "Company Name: $company\r\n\n";
             
    $e_address "Street Address: $streetaddress\r\n\n";
             
    $e_city "City, State, Zip: $city\r\n\n";
                        
             
    $msg $e_body $e_content $e_reply $e_email $e_phone $e_company $e_address $e_city

  • #4
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    I'm wondering what's missing in the "yada yada" portions. Is the form processor/mailer one of the pre-built form mailers or your own? FWIW, I doubt anyone could complain about posting the form's HTML since there's not really anything proprietary about forms and input.
    Are you a Help Vampire?


  •  

    Posting Permissions

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