473,398 Members | 2,427 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Can't unset $_GET

Hi,

I'm biting my nails on this for several days now, hope that someone of
you can help me...:

On my page, the user can display tables, created out of a database. So I
have several <a href> links to display the various tables. They all look
something like:

<a href=this_page.php?table=mytable1>the first table</a>
<a href=this_page.php?table=mytable2>the second table</a>
<a href=this_page.php?table=mytable3>the third table</a>

etc.

so the user clicks on a link and gets the table. now, when he goes back
to the main page, and chooses another link, he always returns to the
initial table, because the $table variable is still somehow "active"

I tried to unset the $_GET array at the start of the code of the main
page, but still it does not work. When i do a print_r($_GET) before and
after the unset, it shows me that in the $_GET array exists before the
unset, but is away after the unset, so everything should be fine.

But why does the $table variable still remain in the system?!?

Please help, I'm totally stuck!!!

thanks a lot,
georg.
Jan 23 '06 #1
2 8928
(un)register globals
--
PETER FOX Not the same since the borehole business dried up
pe******@eminent.demon.co.uk.not.this.bit.no.html
2 Tees Close, Witham, Essex.
Gravity beer in Essex <http://www.eminent.demon.co.uk>
Jan 23 '06 #2
>I'm biting my nails on this for several days now, hope that someone of
you can help me...:

On my page, the user can display tables, created out of a database. So I
have several <a href> links to display the various tables. They all look
something like:

<a href=this_page.php?table=mytable1>the first table</a>
<a href=this_page.php?table=mytable2>the second table</a>
<a href=this_page.php?table=mytable3>the third table</a>

etc.

so the user clicks on a link and gets the table. now, when he goes back
to the main page, and chooses another link, he always returns to the
initial table, because the $table variable is still somehow "active"
You should be looking at $_GET['table'], not $table.
And turn off register_globals.
I tried to unset the $_GET array at the start of the code of the main
page, but still it does not work.
Don't even try this. Altering the $_GET array is a lot like trying
to resurrect someone by retouching their X-rays: editing a copy
does not alter the original.
When i do a print_r($_GET) before and
after the unset, it shows me that in the $_GET array exists before the
unset, but is away after the unset, so everything should be fine.
Consider $_GET read-only, since the browser does not get to see the
modified copy.
But why does the $table variable still remain in the system?!?


Because the browser sends it again (as $_GET['table'], hopefully
not as $table). I'm not sure you have shown enough detail to
determine why. The fact that you are using links relative to the
current page might have something to do with it.

Gordon L. Burditt
Jan 23 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: lawrence | last post by:
Given a bunch of mixes variables, I'm in a situation where I can't know what type they are. Can I use unset to kill an object? unset($object); Can I use unset to kill a pointer to an open...
21
by: steve | last post by:
Dont’ make my mistake. It is costly. Say you have defined a variable $var in your main script. Now in a function you access it using: global $var; But you want to set it to null inside the...
3
by: fasanay | last post by:
Hi everybody I have got the following PHP code which I am trying to convert to ASP any help will be appreciated...I have done most of it but I cant find a replace function for Unset in asp which...
1
by: frizzle | last post by:
Hi group, Why won't $new_var be unset in the following function? Am i missing out something? Greetings Frizzle. *************************************
7
by: fasanay | last post by:
Hi everybody I have got the following PHP code which I am trying to convert to ASP any help will be appreciated...I have done most of it but I cant find a replace function for Unset in asp which...
29
by: CAH | last post by:
Hi Can you avoid that googlebot indexes PHPSESSID pages? Googlebot is indexing pages with PHPSESSID, which makes it think my page has a infinite number of pages. How can one avoid this? ...
2
by: Iain Adams | last post by:
Hey i have a loop like so, foreach($users as $user) { foreach($syncWebUsers as $sync) { //user already synched if($sync == $user) {
5
by: comp.lang.php | last post by:
// NEW 11/27/2006: FINALLY, IF YOU ADDED OR DELETED OR DID ANY KIND OF FORM ACTION SUCCESSFULLY, DON'T RE-DISPLAY THE NEW EXPENSE ITEMS VIA $_POST if ($_POST && (!is_array($leaseObj->errorArray)...
0
Airslash
by: Airslash | last post by:
Hello, I've written a small function to delete a variable from a class' internal array. The variables on their own are custom class objects, and I'm a bit confused about the whole pass by...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.