Retreiving data with register_globals=off

Posted on 2003-12-03
Last Modified: 2006-11-17
My code was working fine until I upgraded to a newer PHP version, now I'm having major problems.

I have an index page, which takes a var like this: ""

I used to use this simple code:


to extract the page number, but this no longer works, so can someone please tell me what I should be using.

I know I can turn on register_globals but i dont want to...

Question by:rjdown
  • 2
  • 2

Expert Comment

ID: 9867008
You don't need to turn on register_globals, but you do need to refer to your variable differently.  Try using this instead


I hope this helps :)

Author Comment

ID: 9867112
Thanks for quick reply but still nothing...

I made a new file, test.php:

echo $page;

now if i go to this using test.php?page=23 i still get a blank page? :'(

Accepted Solution

LornaJane earned 50 total points
ID: 9867210
try this, I don't think I explained myself terribly well before:

$page = $GET['page'];
echo $page;

If you don't understand what the above code does, post back and I'll explain more clearly

Author Comment

ID: 9867586
Oops, my bad.

I had a look through the php manual and found that it should in fact be $_GET. Horrah, my code works again :D

Thanks Lorna :D


Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
echo paypal data on screen 5 54
PHP and google maps 13 46
ebay devID, appID, certID, userToken 2 29
Cpanel file manager 8 25
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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…

803 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