php header

Discussion in 'PHP' started by lektrikpuke, May 26, 2009.

  1. #1
    When I use header to send to another page, can I pass/post info to the new page (at the same time)?

    The reason I ask is if a product doesn't exist, I want to send the user to another page passing the original product code (so I can have the new page look up the product and maybe suggest similar products).

    Thanks for any help.

    Rob :D
     
    lektrikpuke, May 26, 2009 IP
  2. HorseGalleria

    HorseGalleria Peon

    Messages:
    91
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You could resubmit the form data to a new page. Check out the link:

    http://us.php.net/manual/en/function.header.php#89447

    You could also setup a session variable.
     
    HorseGalleria, May 26, 2009 IP
  3. lektrikpuke

    lektrikpuke Well-Known Member

    Messages:
    297
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    113
    #3
    Thanks. That seemed to do the trick. For some reason when I $_POST a variable to a new LOCATION, I have to use $_GET to get the $_POSTed variable. I'm ok with that, though.

    Thank you again. :D
     
    lektrikpuke, May 26, 2009 IP
  4. lektrikpuke

    lektrikpuke Well-Known Member

    Messages:
    297
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    113
    #4
    My bad, not $_POSTing after all. Just went back and looked:

    header("Location: http://url_here/test.php?product_code=$product_code");

    So, maybe $_GET is what I need to use. ;)
     
    lektrikpuke, May 26, 2009 IP