Results 1 to 3 of 3

Thread: Designing a PHP email form confirmation page

  1. #1
    Join Date
    Sep 2006
    Location
    Texas
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Designing a PHP email form confirmation page

    Hello everyone, I have a problem with a PHP email form and was wondering if I could get some help here.

    I have a simple form on a contact page asking for email, subject title, and message. Once the user hits Send, it takes them to a confirmation page, and there is my problem.

    This is what I have for that confirmation page -

    PHP Code:
    <?php 
    $to 
    "email@address.com"

    $headers "From: " $from "\r\n"
    $headers .= "Reply-To: " $from "\r\n"
    $headers .= "Return-Path: " $from "\r\n"
    $from $_POST['sender']; if ( ereg("\r",$from) || ereg("\n",$from) || ereg("%",$from) ) die("Why ?? "); 

    if ( 
    mail($to,$subject,$message,$headers) ) {
    echo 
    "The email has been sent.
    <br><br>
    <a href='index.html'>Click here to Return</a>"

    }else{ 
    echo 
    "The email has failed.
    <br><br>
    <a href='index.html'>Click here to Return</a>"
    ;
    }

    ?>

    Here is my question - how do I make this page look like the rest of the site? I don't know PHP well enough to create a look for this page, instead of the plain white page with black lettering.

    I appreciate any help I can get!!

    Thanks so much,

    Ryan

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    well you can use HTML in PHP, simply start out with the html page, then where-ever you want the confirmation to appear, stop the HTML, then start the PHP code. This may look like this:

    PHP Code:
    <html>
    <head>
    <title>Untitled</title>
    </head>
    <body>

    <!--Add whatever tables or whatnot you need-->

    <?php

    $to 
    "email@address.com"

    $headers "From: " $from "\r\n"
    $headers .= "Reply-To: " $from "\r\n"
    $headers .= "Return-Path: " $from "\r\n"
    $from $_POST['sender']; if ( ereg("\r",$from) || ereg("\n",$from) || ereg("%",$from) ) die("Why ?? "); 

    if ( 
    mail($to,$subject,$message,$headers) ) {
    echo 
    "The email has been sent.
    <br><br>
    <a href='index.html'>Click here to Return</a>"

    }else{ 
    echo 
    "The email has failed.
    <br><br>
    <a href='index.html'>Click here to Return</a>"
    ;
    }

    ?>

    </body>
    </html>
    That's it. Simple,yet effective.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. #3
    Join Date
    Sep 2006
    Location
    Texas
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hey that worked! Thank you so much for your help!!!!


    Thanks again,

    Ryan

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •