Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Simple 2 part question about $_GET AND $_SESSION

Posted on 2002-07-15
8
Medium Priority
?
165 Views
Last Modified: 2006-11-17
What's the difference between $_GET, and $HTTP_GET_VARS? And what does $_SESSION do?
0
Comment
Question by:sargento
  • 5
  • 2
8 Comments
 

Accepted Solution

by:
Theril earned 200 total points
ID: 7155836
$_GET holds exactly the same data as $HTTP_GET_VARS. Shorter names for these predefined arrays were introduced in PHP 4.1.0, maybe because register_globals were removed from default configuration (register_globals registers cookie, session, get, post etc. to simple global variables).
More information: http://www.php.net/manual/en/reserved.variables.php

$_SESSION ($HTTP_SESSION_VARS) is an array that holds data for the current session. For more information on sessions, see: http://www.php.net/manual/en/ref.session.php
0
 
LVL 32

Expert Comment

by:Batalf
ID: 7155840
There are no difference between $_GET and $HTTP_GET_VARS, just 2 ways of refering to the same thing.

$_SESSION is the same as $HTTP_SESSION_VARS and is an assosiative array containing information stored as sessin-variables.

For more info, look at :

http://www.zend.com/manual/ref.session.php
0
 

Author Comment

by:sargento
ID: 7155844
If seen this:
print_r($_SESSION);
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:sargento
ID: 7155846
Does that just verify a session?
0
 

Author Comment

by:sargento
ID: 7155850
Does that just verify a session?
0
 
LVL 32

Expert Comment

by:Batalf
ID: 7155856
NO, it does more than that. It stores all the variables registred in a session.

Example:

<?php
session_start();
if (isset($HTTP_SESSION_VARS['count'])) {
   $HTTP_SESSION_VARS['count']++;
}
else {
   $HTTP_SESSION_VARS['count'] = 0;
}
?>
 
To register the variable:

<?php
if (!session_is_registered('count')) {
    session_register("count");
    $count = 0;
}
else {
    $count++;
}
?>

$HTTP_SESSION_VARS could in this example be replaced by $_SESSION


0
 

Author Comment

by:sargento
ID: 7155907
Does that just verify a session?
0
 

Author Comment

by:sargento
ID: 7156126
i'll put up 50 for Batalf also! THank you both!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question