Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Sep 2009
    Posts
    23
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Post page redirect after form send command

    Hi

    new to coding, so bear with me.

    I have built a simple form on my website. I have used php to validate and send the form via email, all works fine. but once the form is sent I need the user to be directed back to the home page.

    is there a simple way to do this, all the code I can find is reliant on header and wont work as I already have text in the page. unless Im setting it up wrong, which is possible too.

    thanks

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,540
    Thanks
    8
    Thanked 1,093 Times in 1,084 Posts
    Don't have any text on that page.
    If you're going to redirect, what's the point?

    Otherwise, use an HTML (meta tag) redirect after 5 seconds, or whatever.
    Or, a link such as "Click here for main page".

    I would just redirect to a thankyou page and not have any text on the email processor.

  • #3
    New Coder
    Join Date
    Sep 2009
    Posts
    23
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by mlseim View Post
    Don't have any text on that page.
    If you're going to redirect, what's the point?

    Otherwise, use an HTML (meta tag) redirect after 5 seconds, or whatever.
    Or, a link such as "Click here for main page".

    I would just redirect to a thankyou page and not have any text on the email processor.
    ok so I can put html on the php file? didnt realise that! easy then

  • #4
    New Coder
    Join Date
    Sep 2009
    Posts
    23
    Thanks
    3
    Thanked 0 Times in 0 Posts
    that didnt work for me.

    the only text on the page is php code, I would like to redirect to the home page or a thankyou page.

  • #5
    Regular Coder
    Join Date
    Aug 2009
    Posts
    131
    Thanks
    28
    Thanked 7 Times in 7 Posts
    You can write HTML on PHP pages. You could either end your PHP (?>) and write your HTML and then start PHP again (<?php) or you could write HTML directly in echo's.

    PHP Code:
    echo "<b>HTML here</b><br />";
    echo 
    "<a href=\"http://www.google.com\">Google!</a>"// You have to escape the double quotes, though, by adding a back slash. 
    And if you want to redirect the user to another page, you can use META tags or the header(); function.

    PHP Code:
    header("Location: thankyou.html"); 
    You might want to add ob_start(); at the top too, that way it worked for me.
    Last edited by [vengeance]; 09-03-2009 at 09:08 PM.

  • Users who have thanked [vengeance] for this post:

    digi-mech (09-04-2009)

  • #6
    New Coder
    Join Date
    Sep 2009
    Posts
    23
    Thanks
    3
    Thanked 0 Times in 0 Posts
    vengence... many thanks ,thats sorted it for me

    steve

  • #7
    Regular Coder
    Join Date
    Aug 2009
    Posts
    131
    Thanks
    28
    Thanked 7 Times in 7 Posts
    Quote Originally Posted by digi-mech View Post
    vengence... many thanks ,thats sorted it for me

    steve
    You're welcome! Glad I could help.


  •  

    Posting Permissions

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