1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2001
    Rep Power

    Post PHP Session variables after Javascript jump

    Hi everyone,

    I'm using this javascript function to load a specific page:

    function loadPage(pageURL){
    location.href = pageURL.options[pageURL.selectedIndex].value;

    It takes the URL holded by the fields of a SELECT form, and redirects the browser to the new URL, every time the user double clicks an option in the SELECT:


    i checked my PHP session variables after the redirection to a new page and they're all empty!

    What happened to the PHP session i've created in a previous page? I need to pass confidential variables to the new page,
    and it sure won't be a good practise to pass them by the URL.

    Is there any way to preserve the PHP session vars under these circunstances, or another tricky way to call a new page
    ondblclick, like the post method, preserving the session variables?

    I would apreciate your valuable help

  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2001
    Germany - Aachen
    Rep Power

    Normaly PHP keeps the Session alive by setting a cookie containing the Sessionid. This cookie would be send by the browser automaticly.

    If now cookies is disabled try to build URLs like the following in the selectbox - that should work - at least it did for me.

    PHP Code:
    <option value="page2.html?PHPSESSID=<?=session_id()?>">Page 2</option>
    If your Sessionid is name different change it to your needs.

IMN logo majestic logo threadwatch logo seochat tools logo