SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict pentium10's Avatar
    Join Date
    Apr 2004
    Location
    Transilvania
    Posts
    208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SESSION help, new window not same sessionid

    1. There is a job site
    2. Employers post applications on the main window
    3. THEY HAVE THE right to store 5 questions for candidates....
    Each question is added in a blank window, this where i have the problem, the session id is different, and i want to store the inserted questions in session variables...
    Could somebody advice me something....
    How I set the new windows sesid the same as the main window?
    And how I store questionID's in sessions?
    And how mutch questions are added?
    something like $_SESSIONS['totalquestions'],$_SESSIONS['q1'],$_SESSIONS['q2'],$_SESSIONS['q3'],$_SESSIONS['q4'],$_SESSIONS['q5']....


    Is it possible to store in Session arrays with two dimension, something like $_SESSIONS['a[1][1]'] ????????
    Rype :: book, do, charge, collect,
    track time, track expenses and invoice easily on the go.
    Available on Mac, Win, iPhone, WinMobile.
    http://www.rypenow.com

  2. #2
    SitePoint Wizard
    Join Date
    Oct 2001
    Posts
    2,686
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know how you open the new window, but you can pass the session id via the url:
    PHP Code:
    session_start();

    $sid strip_tags(session_id());
    echo 
    '<a href="addquestion.php?sid='$sid '">Add question</a>'
    The $_SESSION variable can be build as any other array:
    PHP Code:
    session_start();

    $_SESSION['var'] = 'Another variable stored in session.';
    // Question #1
    $_SESSION['questions'][1]['q'] = 'Did you like the job';
    $_SESSION['questions'][1]['a'] = 'Yes';
    // Question #2
    $_SESSION['questions'][2]['q'] = 'Was it well paid';
    $_SESSION['questions'][2]['a'] = 'No. You can\'t earn enough';
    // Question #3
    $_SESSION['questions'][3]['q'] = 'Do you want to work with the same again';
    $_SESSION['questions'][3]['a'] = 'Yes';

    /*
    Array
    (
        [var] => Another variable stored in session.
        [questions] => Array
            (
                [1] => Array
                    (
                        [q] => Did you like the job
                        [a] => Yes
                    )

                [2] => Array
                    (
                        [q] => Was it well paid
                        [a] => No. You can't earn enough
                    )

                [3] => Array
                    (
                        [q] => Do you want to work with the same again
                        [a] => Yes
                    )

            )

    )
    */ 
    -Helge

  3. #3
    SitePoint Addict pentium10's Avatar
    Join Date
    Apr 2004
    Location
    Transilvania
    Posts
    208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the info!!!
    Rype :: book, do, charge, collect,
    track time, track expenses and invoice easily on the go.
    Available on Mac, Win, iPhone, WinMobile.
    http://www.rypenow.com


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
  •