Web Analytics Made Easy -
StatCounter Multiple session variables - CodingForum

Announcement

Collapse
No announcement yet.

Multiple session variables

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multiple session variables

    Is it possible to register and store more than 1 session variable for a particular session, or would I have to find some alternative for the othre variables, like passing it to each page in a hidden field?
    Cheers

  • #2
    ok .. not 100% sure but do you mean

    lets say for example

    session name is user

    and teh variables that will be stored in the user session are

    username
    password
    email etc etc etc or did you mean 3 variables with the same name ?

    if i guessed correctly then yes you can
    ==========================
    Find A Date Or Just Friends
    @ http://www.matesonline.co.uk ==========================

    Comment


    • #3
      Yeah, I just want to store 2 different variables in the session. How do you do that then - i currently have
      PHP Code:
      session_register("valid_user"); 
      to store the first.
      Cheers.

      Comment


      • #4
        easy


        ok so i take it valid_user is your session name


        simply $_SESSION['yourvariablename] == "Value"

        then repeat as needed
        eg

        $_SESSION['yourvariablename2] == "Value"
        $_SESSION['yourvariablename3] == "Value"
        hope that helps
        ==========================
        Find A Date Or Just Friends
        @ http://www.matesonline.co.uk ==========================

        Comment


        • #5
          but just the one equals for assignment ...

          PHP Code:
          <?php
          session_start
          ();
          $_SESSION['valid_user'] = 'whatever' ;
          $_SESSION['IP'] = $_SERVER['REMOTE_ADDR'] ;
          //etc
          ?>

          and 2 to check the value

          <?php

          if( $_SESSION['valid_user'] == 'whatever' ) { /*etc*/ } ;
          ?>
          resistance is...

          MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

          Comment


          • #6
            oops ! ha ha

            $_SESSION['my_brain'] != 'is perfectly fine'

            ==========================
            Find A Date Or Just Friends
            @ http://www.matesonline.co.uk ==========================

            Comment


            • #7
              cheers guys

              Comment

              Working...
              X