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( "shngarland@gmail.com", "Feedback Form Results",

    $message, "From: $email" );

     

     

     

     

    header( "Location:
    " );

    }

    ?> 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.