Page 1 of 1

PHP Query String

Posted: Thu Jan 18, 2007 2:22 pm
by wpmcgirth
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hello. I'm having some trouble putting my website to work. It used to work before on another host, but it doesn't work on my current one.

Here's the piece of code i'm having trouble with:

Code: Select all

<?PHP	
if($section=="home") {
include "main.php";
} elseif($section=="link") {
include "link.php";
} elseif($section=="contact") {
include "contact.php";
} elseif($section=="devs") {
include "devs.php";
} elseif(!$page) {
include "main.php";
} 
?>
No matter what's after the ? on the address bar, it always includes main.php on the page. and if i comment the elseif(!$page) part, like this:

Code: Select all

<?PHP	
if($section=="home") {
include "main.php";
} elseif($section=="link") {
include "link.php";
} elseif($section=="contact") {
include "contact.php";
} elseif($section=="devs") {
include "devs.php";
} /* elseif(!$page) {
include "main.php";
} */
?>
it includes nothing.

Anyone could help?


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Thu Jan 18, 2007 2:33 pm
by aaronhall
register_globals was likely disabled. Use the $_GET superglobal instead.

Having register_globals enabled is a security vulnerability, and should be left off.

Posted: Thu Jan 18, 2007 3:23 pm
by feyd
A thread referenced from Useful Posts may be of interest.