First question to ask is: is register_globals on? It should not be!
Also, when you set a variable in the query string, it is set before anycode is executed, so if you set thatsame variable in the code, it will have the value YOU gave it.
Hope it helps.