Results 1 to 11 of 11
  1. #1
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Message after clicking send on php form

    I have done a php contact form but don't know where in the form l could put some text in so that a message can appear after the email has been sent. i.e when they click on "send" a message appears:

    "Thanks for your enquiry"


    http://www.club-amigos.co.uk/contact.htm

    Then returns to the home page.

  2. #2
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Message after clicking send on php form

    <img src=/S/whisper.gif border=0 alt=whisper width=29 height=17>should be http://www.club-amigos.co.uk/contact.html you missed off the l on html
    Jerry

  3. #3
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Message after clicking send on php form

    whoops sorry about that.

    Hi again Jezza, you seem to be regualar.

  4. #4
    Plutonium Lounger Leif's Avatar
    Join Date
    Dec 2000
    Location
    U.K.
    Posts
    14,010
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Message after clicking send on php form

    I think the description you are after is 'confirmation page' - a quick Google brought up this at Experts Exchange as an example.

  5. #5
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Message after clicking send on php form

    Thanks for that, l will look into that.

  6. #6
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Message after clicking send on php form

    I had a look at that and found it a bit confusing!

    This is the script:

    <?php
    // Get submitted data
    $name = $HTTP_POST_VARS['name'];
    $email = 'From: '.$HTTP_POST_VARS['email'];
    $subject = $HTTP_POST_VARS['subject'];
    $message = $HTTP_POST_VARS['message'];

    // Put data into readable format
    $to = 'justin.renn@smiths-aerospace.com';
    $body = 'Name: '.$name.'n'
    .'E-Mail Address: '.$email.'n'
    .'Message: n n'.$message;

    // Send email
    mail($to, $subject, $body, $email);
    ?>


    All l would like to do is to put a thank.html when message has been sent.

  7. #7
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Message after clicking send on php form

    To be frank Justin

    This is quite a heavy and specialist topic you are entering here and not one you are going to get an instant response on....sorry. I have had a search around the www for you to see if there are any tutorials but I don't know quite what you are looking for and what your skill levels are with server side stuff.

    It appears there are quite a few sites set up specifically for php
    Jerry

  8. #8
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Message after clicking send on php form

    I thought l would try woodys first anyway.

  9. #9
    5 Star Lounger
    Join Date
    Apr 2003
    Location
    Hampshire, United Kingdom
    Posts
    602
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Message after clicking send on php form

    Hi Justin

    Assuming that you've created thank.html at http://www.club-amigos.co.uk/thank.html, try adding the following to the end of your PHP code:
    <div style="width: 100%; background-color: #FFFFFF;">header( 'Location: http://www.club-amigos.co.uk/thank.html' ) ;</div hiblock>

    (You can then link or redirect from thank.html to your homepage.)
    I've no idea if it will work, so please let us know how you get on!

    Cheers,
    Waggers
    If at first you do succeed, you&#39;ve probably missed something.

  10. #10
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Message after clicking send on php form

    I have done this and it now validates email and message.

    All that l need to do now is to:

    1. Validate subject

    2. Validate name

    3. Display error message (i.e fields not complete on html page (which l will call validate.html) and not on seperate screen).

    4. Also for some odd reason the cursor moves one space to the right in the message field.
    Any ideas as to why this?

    This is the coding:

    <?
    $email = $_REQUEST['email'] ;
    $message = $_REQUEST['message'] ;

    if (!isset($_REQUEST['email'])) {
    header( "Location: http://www.club-amigos.co.uk/contact.html" );
    }
    elseif (empty($email) || empty($message)) {
    ?>

    <html>
    <head><title>Error</title></head>
    <body>
    <h1>Error</h1>



    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>

    <?
    }
    else {
    mail( "jjr@club-amigos.co.uk", "Feedback Form Results",
    $message, "From: $email" );
    header( "Location: http://www.club-amigos.co.uk/thankyou.htm" );
    }
    ?>

  11. #11
    5 Star Lounger
    Join Date
    Apr 2003
    Location
    Hampshire, United Kingdom
    Posts
    602
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Message after clicking send on php form

    You might be better of starting a new thread (or threads) for those as they're different issues from displaying the "thank you" message that you originally asked about. I'm afraid I've never used PHP before so won't be able to help much. Glad the redirect worked though. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    Waggers
    If at first you do succeed, you&#39;ve probably missed something.

Posting Permissions

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