SID in header

Discussion in 'PHP' started by Greenmethod, Oct 30, 2007.

  1. #1
    I am using php to redirect my page. The problem that I am having is that I need it to carry the session variables with the redirect, and I am having trouble getting it to.

    if ($_GET['cat_no']){
    	$_SESSION['cat_no'] = $_GET['cat_no'];
    	header('Location:http://www.idk.com/invoice.php?SID='.SID);
    };
    PHP:
    I've looked at a few places in the net and that seems to be correct, but it doesn't work right.. any help is much appreciated.
     
    Greenmethod, Oct 30, 2007 IP
  2. cyclotron

    cyclotron Active Member

    Messages:
    213
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    73
    #2
    Most probably a global variables problem. At the top of your code put something like this:

    $SID = $_GET['SID'];

    That's presuming before it redirects, the URL looks something like this:

    http://www.domain.com/invoice.php?SID=something
    Code (markup):
     
    cyclotron, Oct 30, 2007 IP
  3. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #3
    
    $session = session_name() . '=' . session_id();
    header('Location: http://www.idk.com/invoice.php?' . $session);
    exit();
    
    PHP:
     
    nico_swd, Oct 30, 2007 IP