Solved

Simple 2 part question about $_GET AND $_SESSION

Posted on 2002-07-15
8
153 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
8 Comments
 

Accepted Solution

by:
Theril earned 50 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
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 

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

Industry Leaders: 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

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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.

617 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