sever problem $_GET $_POST etc

Started on the old forum in March 2012 · view the original in the archive · old links redirect here

#get #post #server-problem

3 replies · 420 views · started 14 years ago · 1 min read

3 participants
something else Fellow · 2,296 posts #1

Does anybody know why a server would be not collecting $_GET`s or $_POSTS etc? eg:

echo "<a href=\"index.php?hello=hello&world=world\">Same Page</a><br/>";
$text = "Debug: ".$_GET['hello']."=".$_GET['world'];
echo $text;
//out come is:  Debug: = 

I know an answer would be to register globals on but its not a good answer :/

metulj Super moderator Principal · 1,726 posts #2

like this ?

echo "<a href=\"index.php?hello=hello&world=world\">Same Page</a><br/>";
@$hello = $_GET['hello'];
@$world = $_GET['world'];
$text = "Debug: ".$_GET['hello']."=".$_GET['world'];
echo $text;
//out come is:  Debug: = 

😕

It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt. ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ ! ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.

キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

something else Fellow · 2,296 posts #3

i havent tried using "@" to show the error as this problem is not happening with my pc but is on my friends pc (and some peoples phones) so im trying to work blind :/ - but i will try this thankyou 🙂

even with using $hello = $_GET['hello']; doesnt work..... however filtering it through mysql_escape_string() seems to work, which is all well and good but will cause silent errors when the variables are not going into the databse.....

Also mysql_escape_string() doesnt help me for things like $_FILE which is also returning blank

im wondering if i have done something wrong in one of my scripts that has changed something in php.ini I have spoken to the hosts about this and they seem to have no clue why this would be happening and to be honest i dont think they believe me as it works fine for them like it does for me :/

arnage Lead · 811 posts #4

Because globals needs to be checked if its isset and not null, either wit isset() or empty(). 🙂 The easy way is ternary:

$hello = isset($_GET['hello']) ? $_GET['hello'] : null;
<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close