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

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

new
Bible Basics
Houseplants
Romance Movies
Creativity
Family Travel
Southwest USA
Irish Culture


dailyclick
All times in EST

Clairvoyance: 08:00 PM

Full Schedule
g
g PHP Site

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!

Add PHP+Superglobal+Variables+and+Register%5FGlobals to Twitter Add PHP+Superglobal+Variables+and+Register%5FGlobals to Facebook Add PHP+Superglobal+Variables+and+Register%5FGlobals to MySpace Add PHP+Superglobal+Variables+and+Register%5FGlobals to Del.icio.us Digg PHP+Superglobal+Variables+and+Register%5FGlobals Add PHP+Superglobal+Variables+and+Register%5FGlobals to Yahoo My Web Add PHP+Superglobal+Variables+and+Register%5FGlobals to Google Bookmarks Add PHP+Superglobal+Variables+and+Register%5FGlobals to Stumbleupon Add PHP+Superglobal+Variables+and+Register%5FGlobals to Reddit




RSS | Editor's Picks Articles | Top Ten Articles | Previous Features | Site Map


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


Content copyright © 2014 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.

g


g features
Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter


vote
Poetry
Daily
Weekly
Monthly
Less than Monthly



BellaOnline on Facebook
g


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


BellaOnline Editor