|
| |||||||||
| Tags: global array, php, register, session, variable |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| ||||
| ||||
| 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
| ||||
| ||||
| 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
| ||||
| ||||
| 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
| ||||
| ||||
| 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:
__________________ 3.2 (northwood) 2gig ramATI 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
| ||||
| ||||
| 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:
__________________ 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.... |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "How to Register a Variable with $ _SESSION?" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Retrieve Variable In JSP | Amaresh | Software Development | 4 | 10-02-2010 09:14 PM |
| What is the difference between session_register and $_session? | garfield1 | Software Development | 3 | 05-09-2009 09:52 AM |
| Runtime Error 91 : Object Variable or with block variable not set | Ryan21 | Software Development | 2 | 28-08-2009 08:51 PM |
| What is Global Variable static? Declaring static variable instead of Global variable | Reckon | Software Development | 3 | 25-04-2009 12:34 PM |
| Variable height in CSS | Sentential | Software Development | 8 | 22-10-2008 03:51 PM |