Header Redirect (w/ PHP Variable)

Discussion in 'PHP' started by lapsaJ, Mar 26, 2008.

  1. #1
    I am currently redirecting users using the following:

    <?
    header( 'refresh: 0; url=http://website.com' );
    ?>
    Code (markup):

    I want to be able to pass a variable aswell, how do I go about doing that using this method. (For example: http://website.com?id=$id)
     
    lapsaJ, Mar 26, 2008 IP
  2. North Carolina SEO

    North Carolina SEO Well-Known Member

    Messages:
    1,327
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    105
    #2
    Have you tried PHP echo command?
     
    North Carolina SEO, Mar 26, 2008 IP
  3. lapsaJ

    lapsaJ Peon

    Messages:
    1,058
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Figured it out - had to add the variable outside of the quotes with a .
     
    lapsaJ, Mar 26, 2008 IP
  4. blackthought286

    blackthought286 Well-Known Member

    Messages:
    334
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #4
    yeah just add the variables to the end of the url just like in your example. It should work with no problem. Just remember to set in the page that you are pointing to a get method to collect the variable.
     
    blackthought286, Mar 26, 2008 IP