logo
g Text Version
Auto
Beauty & Self
Books & Music
Career
Computers
Education
Family
Food & Wine
Health & Fitness
Hobbies & Crafts
Home & Garden
Money
News & Politics
Relationships
Religion & Spirituality
Society & Culture
Sports
Travel & Leisure
TV & Movies

dailyclick
Bored? Games!
Postcards
Astrology
Take a Quiz
Rate My Photo

new
English Garden
Costuming
Charity
Women's Fashion
Pop Music


dailyclick
All times in EST

Genealogy: 06:00 PM

Autism Spectrum Disorders: 4:00 PM

Full Schedule
g
g PHP Site
Editor Wanted
BellaOnline's PHP Editor

g

PHP Superglobal Variables and Register_Globals
Guest Author - Diane Cipollo

PHP has a special kind of variable which is called a superglobal. The reason these variables are special is because they are automatically available to any PHP program without the programmer creating or defining them in his program. You can think of them as "built-in" variables.

The way you will access these variables differs depending on whether register_globals is turned on or off on your server. Before PHP version 4.2, register_globals was turned on by default. However do to security reasons; this setting is now turned off by default (version 4.2+). Of course it is up to the people who run your server to decide whether to override the default setting and turn register_globals on. The easiest way to test your own server is to use the phpinfo(). You will probably have a link to this webpage in the administrative area of your website. On this webpage you will find the Configuration PHP Core section that has this information.

As mentioned above you will access the superglobals differently depending on the setting of your server. For the new server setup the superglobals were given new names. If your server still has the old setting, it would be better to start using the new names anyway. If you use these new names you can be sure that your programs will work under both server configurations. However, this is not the case for the old names. They will only work for the old server configuration. The chart below shows the old and new names and a description of the superglobals. Notice that the names of these superglobals are in all capital letters.

NewOldDescription
$_GET $HTTP_GET_VARS This superglobal contains the variables sent to the program by the get method such as a guery string.
$_POST $HTTP_POST_VARS This superglobal contains the variables sent to the program by the post method.
$_COOKIE $HTTP_COOKIE_VARS This superglobal contains the variables available to the program from a cookie.
$_SESSION $HTTP_SESSION_VARS This superglobal contains the variables registered by the program via a session.
$_FILES $HTTP_POST_FILES This superglobal contains the variables available from a file upload.
$_ENV $_HTTP_ENV_VARS This superglobal contains the variables available from the server environment.
$_REQUEST -- This superglobal contains the variables sent to a program by any type of user input. This is the most general or universal type of superglobal.
$_SERVER -- This superglobal contains information about the server such as file paths.





This site needs an editor - click to learn more!

RSS | Previous Features | Site Map


Content copyright © 2008 by Diane Cipollo. All rights reserved.
This content was written by Diane Cipollo. If you wish to use this content in any manner, you need written permission. Contact BellaOnline Administration for details.

Digg! g delicious Save to Del.icio.us

g


For FREE email updates, subscribe to the PHP Newsletter


Past Issues


print
Printer Friendly
bookmark
Bookmark
tell friend
Tell a Friend
forum
Forum
email
Email Editor

g features
Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter


vote
Driving Amount
Much more
Slightly more
Slightly less
Much less

g


| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2008 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor