PHP Query String

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
wpmcgirth
Forum Newbie
Posts: 1
Joined: Thu Jan 18, 2007 2:19 pm

PHP Query String

Post 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]
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

A thread referenced from Useful Posts may be of interest.
Post Reply