Grow your CSS skills. Land your dream job.

php autoresponder problem

  • # September 20, 2009 at 12:50 pm

    Hi,
    I’m creating my first php mail script from a form I created, and so far so good. I am able to get the form results emailed to me, but I can’t make it send a response to the form submitter. Do I have it setup wrong? The first mail line (form submit) is working, just the second one (autorespond) is not…?! Any help is greatly appreciated!
    Here’s my code: (links are just example links)

    Code:
    < ?php

    $name = $_REQUEST['name'] ;
    $phone= $_REQUEST ['phone'];
    $address= $_REQUEST ['address'];
    $fax= $_REQUEST ['fax'];
    $email= $_REQUEST ['email'];

    $message = "Name: $namenn";
    $message .= "Phone: $phonenn";
    $message .= "Address: $addressnn";
    $message .= "Fax: $faxnn";
    $message .= "Email: $emailnn";

    $reply = "My auto respond message, thank you, blah blah.";

    if (!isset($_REQUEST['name']))
    header( "Location: http://www.mysite.com/test/orderform.html" );

    elseif (empty($name) || empty($phone) || empty($email)) {
    header( "Location: http://www.mysite.com/error.html" );
    }

    else {
    mail( "info@mysite.com", "Submitted Order Form", $message, "From: $email" );
    mail( "$email", "Order Confirmation", $reply, "From: MySite" );
    header( "Location: http://www.mysite.com/thankyou.html" );
    }

    ?>

    # September 21, 2009 at 8:10 pm

    I don’t thin that the $email should be in quotations.

    Code:
    mail( $email, “Order Confirmation”, $reply, “From: MySite” );

    Try this.

    # September 22, 2009 at 12:16 pm

    Also this looks weird:

    Code:
    $_REQUEST ['email'];

    maybe you need to remove the spaces in the request like this:

    Code:
    $_REQUEST['email'];
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".