Results 1 to 5 of 5

Thread: How to Register a Variable with $ _SESSION?

  1. #1
    Join Date
    Aug 2006
    Posts
    201

    How to Register a Variable with $ _SESSION?

    Hi friends,
    I would like to thank you first for the help that you did last time. Now I need your help more.!! I want to know about the $_Session. Actually I want to register a variable using that. I don't have much knowledge about that. So i have not tried to do anything. Please tell me how to Register a variable with $ _SESSION? Help me as soon as you can.!!
    Don't be afraid of darkness, it's in your heart anyway.

  2. #2
    Join Date
    Mar 2008
    Posts
    349

    Re: How to Register a Variable with $ _SESSION?

    If register_globals is disabled, only elements of the global array $ _SESSION contain variables recorded in the session. The restored session variables will only be available in $ _SESSION. You should keep in mind that $ _SESSION is available as a global variable just like $ _POST, $ _GET, $ _REQUEST, etc. Therefore, you do not need to use the reserved word global with $ _SESSION. The array keys $ _SESSION are subject to the same limitations as regular variable names in PHP. For example, you cannot start with a number, but start with a letter or underscore '_'.

  3. #3
    Join Date
    Jul 2006
    Posts
    289

    Re: How to Register a Variable with $ _SESSION?

    If register_globals is disabled, only elements of the global array $ _SESSION contain variables recorded in the session. The restored session variables will only be available in $ _SESSION. Use of $ _SESSION is recommended for improved security and code readability. With $ _SESSION, there is no need to use functions session_register (), session_unregister () and session_is_registered ().Session variables are accessible like any other variable.
    Signatures reduce available bandwidth

  4. #4
    Join Date
    Aug 2006
    Posts
    235

    Re: How to Register a Variable with $ _SESSION?

    I am providing you with the coding that will help you to register a variable with $ _SESSION. So , just have a look at the sample of coding :
    PHP Code:
    <?php 
    session_start 
    (); 
    if (!isset( 
    $_SESSION 'count' ])) { 
    $_SESSION 'count' ] = 
    } else { 
    $_SESSION 'count' ]++; 

    ?>
    3.2 (northwood)
    2gig ram
    ATI AIW X800xt 256mb
    Gigabyte GA-8knxp 875p Chipset
    Optiwrite 8X DVD Burner
    Win XP PRO Sp2 (Works Perfectly)
    2 SATA Raptor 74gig Raid 0
    2 7200 IDE 320gig HD

  5. #5
    Join Date
    Jul 2006
    Posts
    286

    Re: How to Register a Variable with $ _SESSION?

    If register_globals is enabled, then each global variable can be registered as session variables, and all session variables will be reconstructed as global variables. Since PHP must know which global variables are registered as session variables, users need to register variables with session_register () while $ HTTP_SESSION_VARS and $ _SESSION does not require session_register (). You can remove a variable with $ _SESSION and register_globals disabled by using the following code :
    PHP Code:
    <?php 
    session_start 
    (); 
    unset( 
    $_SESSION 'count' ]); 
    ?>
    IF you hate me, please don't mention it. I know who hates me and who doesn't. You really do not have to make fun of people....

Similar Threads

  1. Retrieve Variable In JSP
    By Amaresh in forum Software Development
    Replies: 4
    Last Post: 10-02-2010, 09:14 PM
  2. What is the difference between session_register and $_session?
    By garfield1 in forum Software Development
    Replies: 3
    Last Post: 05-09-2009, 08:52 AM
  3. Replies: 2
    Last Post: 28-08-2009, 07:51 PM
  4. Replies: 3
    Last Post: 25-04-2009, 11:34 AM
  5. Variable height in CSS
    By Sentential in forum Software Development
    Replies: 8
    Last Post: 22-10-2008, 02:51 PM

Tags for this Thread

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
  •  
Page generated in 1,711,653,009.92493 seconds with 16 queries