SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Page Redirect based on Condition

    Throughout my site I have a couple different signup forms for a newsletter. I have created a thank you page for all those signups.
    From the thank you page I am trying to create a redirect command to a new page based on what page/form (each page having a different form.) they signed up on.
    I would like it to be timed so they can see and read one short line on the page saying "thanks for signing up" before being redirected.
    I am open to suggestions using php,java or multiple meta redirects. I have not yet created any code because know what the command would be for sending a redirect based on the page they came from or form they signed up.

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,705
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by bladysh View Post
    Throughout my site I have a couple different signup forms for a newsletter. I have created a thank you page for all those signups.
    From the thank you page I am trying to create a redirect command to a new page based on what page/form (each page having a different form.) they signed up on.
    I would like it to be timed so they can see and read one short line on the page saying "thanks for signing up" before being redirected.
    I am open to suggestions using php,java or multiple meta redirects. I have not yet created any code because know what the command would be for sending a redirect based on the page they came from or form they signed up.
    A common way of doing this is to load the thankyou page with a querystring of where the redirect is going to go.
    http://www.domain.com/thankyou.php?r...oppinglist.php

    Then, the thankyou.php page sets a timed meta-redirect to the place in the querystring.

    PHP Code:
    $location filter_input(INPUT_GET'return'FILTER_SANITIZE_URL);
    echo 
    '<meta http-equiv="refresh" content="10;url=http://' $_SERVER['PHP_HOST'] + '/' $location '">'
    I'm not in a position to test as of this moment, but something like that does the job.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you for the reply,
    So let me try to understand the flow. Where would the thankyou.php come into play? Sorry as I am a little unfamiliar with the coding you listed. I send them to the thankyou.html page with code similar to what you posted and it relays to a thankyou.php with a query string that gives them a redirect to where i want them to go?

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,705
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by bladysh View Post
    thank you for the reply,
    So let me try to understand the flow. Where would the thankyou.php come into play? Sorry as I am a little unfamiliar with the coding you listed. I send them to the thankyou.html page with code similar to what you posted and it relays to a thankyou.php with a query string that gives them a redirect to where i want them to go?
    If you use thankyou.html then you won't be able to use PHP to create the redirect. Instead, you will need to rely on JavaScript being available and use that to perform the redirect instead.

    Using JavaScript for the redirect is not a good solution for this problem. It can do it, but nowhere near as well as when using server-side code such as PHP.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would like to use the simplest and most effective way possible. If I use a thank you.php and redirect based on criteria, taking them straight to the redirect it would be fine. I would however like to have them see some kind of "thank you" page because I would like them to see that I am greatful but also to let them know that they need to confirm the sign up through an automatic email that is sent out once they submit their details.

  6. #6
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,705
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by bladysh View Post
    I would like to use the simplest and most effective way possible. If I use a thank you.php and redirect based on criteria, taking them straight to the redirect it would be fine. I would however like to have them see some kind of "thank you" page because I would like them to see that I am greatful but also to let them know that they need to confirm the sign up through an automatic email that is sent out once they submit their details.
    The content attribute of the http-equiv refresh is made up of two parts separated by a semicolon. The number of seconds to wait, and the url to load.
    It will wait for the number of seconds before loading the url.

    Do you see the 10 (for 10 seconds) in the example I gave?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


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
  •