Can someone please confirm that the $SESSION command works fine with PHP 4.3.1. And if anyone has any examples of this $SESSION function being used then I would like to take a look.

Thanks,

w.

    1) Read the user manual! for PHP 4.3.1 on Sessions.

    2) Here is some code:

    Put this at the top of your page...

    <?php session_start(); ?>

    Then where ever you will be setting session variables just assign them like this:

      if (!isset($_SESSION['mysession'])) {
        $_SESSION['mysession'] = session_id();
      }
    
      $thissession=$_SESSION['mysession'];
    

    3) Search this FORUM for $_SESSION and I am sure you will find plenty of examples on how to use sessions...

      thanks,

      The reason I asked is that I'm having a few problems with it and I found a reference to $_SESSION not work in php 4.1.2. But I'm sure that thanks to you, I will have the script up and working in 5 minutes!

      rgds,

      w.

        If you are using 4.1.2 you have to use $HTTP_SESSION_VARS['var'] instead of $_SESSION. I forced my host to change because I wrote a whole cart system on my local system using 4.3.1 and then uploaded it and it did not work... bummer. Somewhere on this forum there is a good example of how to deal with that. I found it one day, doing a search, that dealt with setting session variables and backwards compatibility. Glad to help...

          Write a Reply...