473,657 Members | 2,567 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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=mytab le1>the first table</a>
<a href=this_page. php?table=mytab le2>the second table</a>
<a href=this_page. php?table=mytab le3>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 8956
(un)register globals
--
PETER FOX Not the same since the borehole business dried up
pe******@eminen t.demon.co.uk.n ot.this.bit.no. html
2 Tees Close, Witham, Essex.
Gravity beer in Essex <http://www.eminent.dem on.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=mytab le1>the first table</a>
<a href=this_page. php?table=mytab le2>the second table</a>
<a href=this_page. php?table=mytab le3>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_global s.
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
2123
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 file? unset($fp); Can I use unset to kill a pointer to a database return? unset($mySqlResult);
21
3380
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 function. DO: $var = null; DONT DO: unset($var);
3
4106
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 will discard the variable alltogether... if ($categoryid == "all") { $sql = "SELECT * FROM products where shopinspection=$shopinspection"; unset($HTTP_POST_VARS); unset($HTTP_POST_VARS);
1
1884
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
1850
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 will discard the variable alltogether... if ($categoryid == "all") { $sql = "SELECT * FROM products where shopinspection=$shopinspection"; unset($HTTP_POST_VARS); unset($HTTP_POST_VARS);
29
4860
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? Here is an exsample of url that google register, that might make is more clear what is happening www.winches.dk/winches.php?artnr=500735&PHPSESSID=d22126f0d46334659ff...
2
1566
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
2292
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) || @sizeof($leaseObj->errorArray) == 0)) { print_r(array_keys($_POST)); @reset($_POST); $tempPost = $_POST; foreach ($_POST as $key =$val) if (strpos($key, 'new_') === 0) array_remove($tempPost, $tempPost);
0
1412
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 reference thing. First I'll show you the code: # removes a parameter from the array. # variables are passed as reference to prevent overhead.
0
8392
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8823
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8730
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7321
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6163
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1607
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.