1. This website uses cookies. By continuing to use this website you are giving consent to cookies being used.
    For information on cookies and how you can disable them visit our Cookie Usage page.
    Dismiss Notice

PHP need help

Discussion in 'Web Development' started by number1, May 2, 2011.

  1. number1

    number1 New Member

    I have a contact form php coding that looks like this:
    It doesn't seem to be working. Can somone help me with this?

    <?php
    //print "<pre>";
    //print_r ($_POST);exit;

    $name1_field=$_POST['firstname'];
    $name2_field=$_POST['lastname'];
    $zipcode_field=$_POST['zipcode'];
    $dayphone_field=$_POST['daytimephone'];
    $evenphone_field=$_POST['eveningphone'];
    $email_field=$_POST['email'];
    $comments_field=$_POST['comments'];

    if(isset($_POST['submit'])){
    $message = "$name1_field, $name2_field. (zip code: $zipcode_field> $dayphone_field daytime phonenumber, $evenphone_field evening phone number, comments: $comments_field";
    $message = htmlentities($message);

    $headers ="MIME-Version: 1.0" ."/r/n";
    $headers .="Content-Type: text/html; charset=utf-8" ."/r/n";
    $headers .="From: $email_field";

    mail("myemail@gmail.com", "A New Message From StayAtHomeSolutions.com", $message, $headers);

    header('Location:contact.php');
    }else{
    header('Location:index.php');
    }
    ?>
     
  2. tomw

    tomw Member

    I tried it and it worked. The first two lines of headers probably not needed. Read this, it might give you more info.