Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4

Thread: PHP mail()

  1. #1
    Junior Member nathacof's Avatar
    Join Date
    Sep 2006
    Posts
    10
    Member #
    14015
    PHP Code:
    <?php
    $clientName 
    "$_POST['firstName'] $_POST['middleInitial'] $_POST['lastName']";
    $streetAdd $_POST['cityState'];
    $state $_POST['zip'];
    $dob "$_POST['birthMonth'] $_POST['birthDay'] $_POST['birthYear']";
    $age $_POST['age'];
    $contactNum $_POST['homePhone'];
    // multiple recipients
    $to 'fake@email.com'
    // subject
    $subject "Intake: $clientName";
    // message
    $message "
    <html>
    <head>
    <title>Intake for 
    $clientName</title>
    </head>
    <body>
    <h1>You have a new intake request </h1>
    <p><strong>Client:</strong> 
    $clientName</p>
    <p><strong>Address:</strong><br /> 
    $streetAdd<br />$state</p>
    <p>D.O.B.<br /> 
    $dob <strong>Age:</strong> $age</p>
    </body>
    </html>
    "
    ;
    // To send HTML mail, the Content-type header must be set
    $headers 'MIME-Version: 1.0' "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' "\r\n";
    // Additional headers
    $headers .= 'From: Automated Intake <fake@email.com>' "\r\n";
     
    // Mail it
    mail($to$subject$message$headers);
    ?>
    I have a form that I'm working on for my job and was wondering what was wrong with this script. When the form is submitted I never recieve an e-mail. Basically I need to debug the script but I don't know if I should be redirecting the page with javascript once the submit button is released, or if I can do that with the php script. I would like to do it with php cause it probably will make debugging my mail script easier.

    Any help is greatly appreciated.
    -Nathan
    "When the Power of Love overcomes the Love of Power the world will know peace" -Jimi Hendrix

  2.  

  3. #2
    Senior Member karinne's Avatar
    Join Date
    Dec 2003
    Location
    Aylmer QC Canada
    Posts
    1,607
    Member #
    4335
    Liked
    8 times
    A few things I saw

    PHP Code:
    $clientName $_POST['firstName']." ".$_POST['middleInitial']." ".$_POST['lastName']; 
    PHP Code:
    $dob $_POST['birthMonth']."/".$_POST['birthDay']."/".$_POST['birthYear']; 
    And you have a ' missing here

    PHP Code:
    $to 'fake@email.com'
    [a web design portfolio - Currently NOT AVAILABLE for work | web design | Re-coding | PSD-to-HTML]
    I'm also on: virb - facebook - twitter - flickr - del.icio.us

  4. #3
    Junior Member nathacof's Avatar
    Join Date
    Sep 2006
    Posts
    10
    Member #
    14015
    Wow thanks for the quick reply. Looking at it now I had noticed a few inconsistencies when I posted. I was actually in the process of editing the code in order to reflect what is actually in my script.

    PHP Code:
    $clientName $_POST['firstName']." ".$_POST['middleInitial']." ".$_POST['lastName']; 
    I had originally set it up like that but I didn't know if that was a better practice than using the double quotes. I had read on php.net that using the . was often times slower than just the double quotes. In this case it may not even matter considering the simplicity of the script so I have changed it back.
    Basically I was looking more for info on how to best debug a php script that's being called from a form. Thanks again for your quick reply.
    -Nathan
    "When the Power of Love overcomes the Love of Power the world will know peace" -Jimi Hendrix

  5. #4
    Junior Member nathacof's Avatar
    Join Date
    Sep 2006
    Posts
    10
    Member #
    14015
    My issues have been resovled. The problem was that I accidentally assigned action="contactIntake.php" to the div that contained the form instead of the form it's self.
    Silly me hehe
    -Nathan
    "When the Power of Love overcomes the Love of Power the world will know peace" -Jimi Hendrix


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 04:22 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com