Treehouse: Grow your CSS skills. Land your dream job.

php autoresponder problem

  • # September 20, 2009 at 12:50 pm

    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)

    < ?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:" );

    elseif (empty($name) || empty($phone) || empty($email)) {
    header( "Location:" );

    else {
    mail( "", "Submitted Order Form", $message, "From: $email" );
    mail( "$email", "Order Confirmation", $reply, "From: MySite" );
    header( "Location:" );


    # September 21, 2009 at 8:10 pm

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

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

    Try this.

    # September 22, 2009 at 12:16 pm

    Also this looks weird:

    $_REQUEST [’email’];

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

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.