Formmail.php error in sending mail. Fields blank.

Discussion in 'PHP' started by guirigales, May 28, 2010.

  1. #1
    Hello all.

    Ill begin by saying that I am an absolute novice with php. I have just done my first "includes.php" in my web and all is well.

    Now... I have a contact form which was working fine but I wanted to have a thankyou message replace the contact box (rather than take me to a fresh page).

    I downloaded this http://www.visibilityinherit.com/code/jquery-ajaxsubmit.php and got the example to work fine.

    Mine comes back with only the original 2 fields the author included and blank.

    Heres the formmail.php code.

    <?php
    // Insert your email/web addresses and correct paths
    $mailto = 'hello@hmwebsolutions.co.uk' ;
    $from = "http://www.hmwebsolutions.co.uk" ;
    $formurl = "http://www.hmwebsolutions.co.uk/formmail.php" ;
    $errorurl = "http://www.hmwebsolutions.co.uk/error.php" ;
    $thankyouurl = "http://www.hmwebsolutions.co.uk/thankyou.php" ;
    
    // Place Your Form info here...
    $name = ($_POST['name']);
    $email = ($_POST['email']);
    $message= ($_POST['message']);
    
    // Check If Empty
    if (empty($name) || empty($email)) {
       header( "Location: $errorurl" );
       exit ;
    }
    // Add more Validation/Cleaning here...
    
    // Place your Corresponding info here...
    $message =
    	
    	"Name: $name\n\n" .
    	"Email: $email\n\n"
    	
    ;
    
    // Leave Alone
    mail($mailto, $from, $message,
    	"From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep );
    header( "Location: $thankyouurl" );
    exit ;
    
    ?>
    
    Code (markup):
    Does anyone have any idea what Im dojng wrong?

    Thanks in advance.

    nathan
     
    guirigales, May 28, 2010 IP
  2. guirigales

    guirigales Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I can now receive the Name part. What the heck am i doing wrong?
     
    guirigales, May 28, 2010 IP