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 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Oct 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Registration mail form not posting all data

    Hi all,

    I have been working on this script trying to make it work for days now, and have a deadline coming up. I am not a coder per se and cannot pinpoint the problem that is affecting this script:

    <?php
    if ($_POST["email"]<>'') {
    $ToEmail = 'joebuzz83@gmail.com';
    $EmailSubject = 'Site contact form ';
    $mailheader = "From: ".$_POST["email"]."\r\n";
    $mailheader .= "Reply-To: ".$_POST["testingheader"]."\r\n";
    $mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $MESSAGE_BODY .= "First Name: ".$_POST["fname"]."<br>";
    $MESSAGE_BODY .= "Last Name: ".$_POST["lname"]."<br>";
    $MESSAGE_BODY .= "Address: ".$_POST["address"]."<br>";
    $MESSAGE_BODY .= "Address Cont: ".$_POST["address2"]."<br>";
    $MESSAGE_BODY .= "City: ".$_POST["city"]."<br>";
    $MESSAGE_BODY .= "State: ".$_POST["state"]."<br>";
    $MESSAGE_BODY .= "Zip: ".$_POST["zip"]."<br>";
    $MESSAGE_BODY .= "Home Phone: ".$_POST["homenum"]."<br>";
    $MESSAGE_BODY .= "Cell Phone: ".$_POST["cellnum"]."<br>";
    $MESSAGE_BODY .= "Email: ".$_POST["email"]."<br>";
    $MESSAGE_BODY .= "How did you hear about the Event? ".nl2br($_POST["comment"])."<br>";
    mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure");
    ?>
    Your message was sent
    <?php
    } else {
    ?>
    <form action="registration1.php" method="post">
    <table width="400" border="0" cellspacing="2" cellpadding="0">
    <tr>
    <td width="29%" class="bodytext">First name:</td>
    <td width="71%"><input name="fname" type="text" id="fname" size="32"></td>
    </tr>
    <tr>
    <td width="29%" class="bodytext">Last name:</td>
    <td width="71%"><input name="lname" type="text" id="lname" size="32"></td>
    </tr><tr>
    <td width="29%" class="bodytext">Address:</td>
    <td width="71%"><input name="address" type="text" id="address" size="32"></td>
    </tr><tr>
    <td width="29%" class="bodytext">Address cont.:</td>
    <td width="71%"><input name="address2" type="text" id="address2" size="32"></td>
    </tr><tr>
    <td width="29%" class="bodytext">City:</td>
    <td width="71%"><input name="city" type="text" id="city" size="32"></td>
    </tr><tr>
    <td width="29%" class="bodytext">State:</td>
    <td width="71%"><input name="state" type="text" id="state" size="32"></td>
    </tr><tr>
    <td width="29%" class="bodytext">Zip:</td>
    <td width="71%"><input name="zip" type="text" id="zip" size="32"></td>
    </tr><tr>
    <td width="29%" class="bodytext">Home Phone:</td>
    <td width="71%"><input name="homenum" type="text" id="homenum" size="32"></td>
    </tr>
    <tr>
    <td width="29%" class="bodytext">Cell Phone:</td>
    <td width="71%"><input name="cellnum" type="text" id="cellnum" size="32"></td>
    </tr>
    <tr>
    <td class="bodytext">Email address:</td>
    <td><input name="email" type="text" id="email" size="32"></td>
    </tr>

    <tr>
    <td class="bodytext">How did you hear about the Event?</td>
    <td><textarea name="comment" cols="45" rows="6" id="comment" class="bodytext"></textarea></td>
    </tr>
    <tr>
    <td class="bodytext">&nbsp;</td>
    <td align="left" valign="top"><input type="submit" name="Submit" value="Send"></td>
    </tr>
    </table>
    </form>
    <?php
    };
    ?>


    It is only posting the cellnum, email and "How did you hear about the Event?" fields. \

    I'm sorry if this has been answered many times before.

  • #2
    New Coder
    Join Date
    Dec 2009
    Posts
    84
    Thanks
    6
    Thanked 3 Times in 3 Posts
    Your code:

    PHP Code:
    $MESSAGE_BODY .= "How did you hear about the Event? ".nl2br($_POST["comment"])."<br>"
    Change To:

    PHP Code:
    $MESSAGE_BODY .= "How did you hear about the Event? ".nl2br($_POST["comment"])."<br />"
    and i advice you to change all <br> to <br />

    Before PHP 4.0.5, the nl2br() function inserted <br>. After PHP 4.0.5 it inserts the XHTML compliant <br />.

    Definition and Usage:

    The nl2br() function inserts HTML line breaks (<br />) in front of each newline (\n) in a string.
    Last edited by sir.jones; 01-19-2010 at 11:16 AM.
    Best Regards,

  • #3
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    Quote Originally Posted by joebuzz83 View Post
    It is only posting the cellnum, email and "How did you hear about the Event?" fields. \

    I'm sorry if this has been answered many times before.
    Do you mean that it is literally only sending something like this:
    "Cell Phone: 123-4567-8910<br>Email: address@domain.com<br>How did you hear about the Event? Method of hearing about event<br>"
    Or is it sending something more like this:
    First Name: <br>Last Name: <br>Address: <br>Address Cont: <br>City: <br>State: <br>Zip: <br>Home Phone: <br>Cell Phone: 123-4567-8910<br>Email: address@domain.com<br>How did you hear about the Event? Method of hearing about event<br>"
    When the end product should look like this:
    First Name: John<br>Last Name: Doe<br>Address: Address Line 1<br>Address Cont: Address Line 2<br>City: City<br>State: State<br>Zip: 12345<br>Home Phone: 123-456-7890<br>Cell Phone: 123-4567-8910<br>Email: address@domain.com<br>How did you hear about the Event? Method of hearing about event<br>"
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. –G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting

  • #4
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    sir.jones: How would that fix data not showing up?

    joebuzz83: Dump the $_POST variable to see what's inside. Try something like:
    PHP Code:
    echo '<pre>';
    print_r($_POST);
    echo 
    '</pre>'
    Are you a Help Vampire?

  • #5
    New to the CF scene
    Join Date
    Oct 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rowsdower, currently the emailed results only show:

    cell number: 123456789
    email: test@aaa.com
    how did...event? (answer)

    tomws,
    do I post that code above the mail script?

    Sir jones,
    I added the / to all br tags.

  • #6
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    Above, below, anywhere really. It will dump the array with some visual structure. On first page load it will show an empty array. On form submit, it will show you what's actually being passed.
    Are you a Help Vampire?

  • #7
    New Coder
    Join Date
    Dec 2009
    Posts
    84
    Thanks
    6
    Thanked 3 Times in 3 Posts
    OK, joebuzz83
    that you mean:
    First Name:
    Last Name:
    Address:
    Address
    City:
    State:
    Zip:
    Home Phone:
    not showing up?

    hm... using <BR /> it just the function inserted compliant to PHP 4.0.5 +

    personally, if i create the form as you like:
    PHP Code:
    <?php
    if ($_POST["email"]<>'') {
    $ToEmail 'joebuzz83@gmail.com\r\n';
    $EmailSubject 'Site contact form\r\n';
    $mailheader "From: ".$_POST["email"]."\r\n";
    $mailheader .= "Reply-To: ".$_POST["testingheader"]."\r\n";
    $mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $mailheader .= "MIME-Version: 1.0\r\n"//<--
    $MESSAGE_BODY .= "First Name: ".$_POST["fname"]."<br />";
    $MESSAGE_BODY .= "Last Name: ".$_POST["lname"]."<br />";
    $MESSAGE_BODY .= "Address: ".$_POST["address"]."<br />";
    $MESSAGE_BODY .= "Address Cont: ".$_POST["address2"]."<br />";
    $MESSAGE_BODY .= "City: ".$_POST["city"]."<br />";
    $MESSAGE_BODY .= "State: ".$_POST["state"]."<br />";
    $MESSAGE_BODY .= "Zip: ".$_POST["zip"]."<br />";
    $MESSAGE_BODY .= "Home Phone: ".$_POST["homenum"]."<br />";
    $MESSAGE_BODY .= "Cell Phone: ".$_POST["cellnum"]."<br />";
    $MESSAGE_BODY .= "Email: ".$_POST["email"]."<br />";
    $MESSAGE_BODY .= "How did you hear about the Event? ".stripslashes($_POST["comment"])."<br />"//<--
    mail($ToEmail$EmailSubject$MESSAGE_BODY$mailheader) or die ("Failure");
    ?>
    or sometimes i just change stripslashes with htmlspecialchars
    Note: for sent value using $_POST["comment"], you no need to use nl2br.
    Use nl2br when you call data from data...
    Last edited by sir.jones; 01-19-2010 at 04:43 PM.
    Best Regards,

  • #8
    New Coder
    Join Date
    Dec 2009
    Posts
    84
    Thanks
    6
    Thanked 3 Times in 3 Posts
    and also use double quote (") and single quote (') it can be effecting different result

    Examples to related your case:

    PHP Code:
    if ($_POST['email']<>"") {
    $ToEmail "joebuzz83@gmail.com\r\n";
    $EmailSubject "Site contact form\r\n";
    $mailheader "From: ".$_POST['email']."\r\n";
    $mailheader .= "Reply-To: ".$_POST['testingheader']."\r\n";
    $mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $mailheader .= "MIME-Version: 1.0\r\n"//<--
    $MESSAGE_BODY .= "First Name: ".$_POST['fname']."<br />";
    $MESSAGE_BODY .= "Last Name: ".$_POST['lname']."<br />";
    $MESSAGE_BODY .= "Address: ".$_POST['address']."<br />";
    $MESSAGE_BODY .= "Address Cont: ".$_POST['address2']."<br />";
    $MESSAGE_BODY .= "City: ".$_POST['city']."<br />";
    $MESSAGE_BODY .= "State: ".$_POST['state']."<br />";
    $MESSAGE_BODY .= "Zip: ".$_POST['zip']."<br />";
    $MESSAGE_BODY .= "Home Phone: ".$_POST['homenum']."<br />";
    $MESSAGE_BODY .= "Cell Phone: ".$_POST['cellnum']."<br />";
    $MESSAGE_BODY .= "Email: ".$_POST['email']."<br />";
    $MESSAGE_BODY .= "How did you hear about the Event? ".stripslashes($_POST['comment'])."<br />"//<--
    mail($ToEmail$EmailSubject$MESSAGE_BODY$mailheader) or die ("Failure"); 
    Best Regards,


  •  

    Posting Permissions

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