GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Super Easy PHP question (https://gfy.com/showthread.php?t=407747)

kemp 12-24-2004 11:55 AM

Super Easy PHP question
 
Why doesn't this work any more? (assuming the code is inside of test.php)

<a href="test.php?table=oral">ORAL</a>

<?
print("$table");
?>

It used to work for me on an older server. But now it says no variable is defined for $table when you click on the ORAL link. WTF?

azguy 12-24-2004 11:55 AM

globals is off. use $_GET["table"] instead

StuartD 12-24-2004 11:56 AM

Because on the new server, global variables are probably turned off.

which means that if you pass something in the url, you have to get it like this:
$_GET[table];

and if you pass it in a form, it's like this:
$_POST[table];

Harmon 12-24-2004 11:56 AM

Correction. This is a "not so easy php question" now isn't it :zzwhip

kemp 12-24-2004 11:56 AM

Thanks azguy - I knew it had to be something incredibly simple

azguy 12-24-2004 11:56 AM

you can also turn on register_globals in your php.ini if you want

fuzebox 12-24-2004 11:57 AM

Quote:

Originally Posted by azguy
globals is off. use $_GET["table"] instead

If you're lazy you can also use $_REQUEST if you don't feel like differentiating between _GET and _POST.

kemp 12-24-2004 11:57 AM

Dang, you guys post quick. lol

kemp 12-24-2004 11:58 AM

Quote:

Originally Posted by fuzebox
If you're lazy you can also use $_REQUEST if you don't feel like differentiating between _GET and _POST.

Is there any speed differences (assuming this page will one day get 500k a day)?

azguy 12-24-2004 11:59 AM

Quote:

Originally Posted by kemp
Is there any speed differences (assuming this page will one day get 500k a day)?

you wouldn't feel it even if there was :)

dubsix 12-24-2004 12:05 PM

Quote:

Originally Posted by fuzebox
If you're lazy you can also use $_REQUEST if you don't feel like differentiating between _GET and _POST.

I can't believe people still don't know abou register globals... it's been off in php by default for what 1+ year now?

azguy 12-24-2004 12:07 PM

Quote:

Originally Posted by WireSix-Ryan
I can't believe people still don't know abou register globals... it's been off in php by default for what 1+ year now?

Since v4.2.0, yeah.

StuartD 12-24-2004 12:08 PM

Quote:

Originally Posted by WireSix-Ryan
I can't believe people still don't know abou register globals... it's been off in php by default for what 1+ year now?

uhmm... not everyone who deals with php is a programmer... and not all programmers have been working consistantly for years.

There's people out there who don't deal with a bunch of code day in and day out, they don't have to deal with this stuff. That's what diversity is all about.


All times are GMT -7. The time now is 09:49 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123