Jump to content

Help with email form.


shane_77

Recommended Posts

  1. I'm trying to code my first php contact form from a tutorial I found and I have it working fine except Im not receiving the information from all the fields. Im having trouble adding the fields at the end of the code. Could somebody please help me out and tell me how to add the name and phone fields into the script.

     

    Many Thanks

     

    Shane.

     

    < ?php

    $name = $_REQUEST['name'] ;

    $email = $_REQUEST['email'] ;

    $phone = $_REQUEST['phone'] ;

    $message = $_REQUEST['message'] ;

     

     

    if (!isset($_REQUEST['email'])) {

    header( "Location:
    " );

    }

    elseif (empty($name) || empty($email) || empty($phone) || empty($message)) {

     

    header( "Expires: Mon, 20 Dec 1998 01:00:00 GMT" );

    header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );

    header( "Cache-Control: no-cache, must-revalidate" );

    header( "Pragma: no-cache" );

    ?>

     

     

     

     

     

     

     

    <html>

    <head><title>Error</title></head>

    <body>

    <h1>Error</h1>

    <p>

    Oops, it appears you forgot to enter either your

    email address or your message. Please press the BACK

    button in your browser and try again.

    </p>

    </body>

    </html>

     

    <?php

    }

    else {

    mail( "[email protected]", "Feedback Form Results",

    $message, "From: $email" );

     

     

     

     

    header( "Location:
    " );

    }

    ?> 

 

Link to comment
https://forums.phpfreaks.com/topic/289898-help-with-email-form/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.