Jump to content

$_GET Problem.


a1amattyj

Recommended Posts

Hey Guys,

 

With my page now, i have a $_GET issue,

What i want to happen is, if i view the page, forums.php or forums.php?page=BLAH then it will display the code ive got down. Other codes are in this file, for example if($_GET['act'] == 'delete'){ etc etc.

 

So far ive tried :

 

if($_GET && $_GET['page']){

 

If i visit forums.php?page=BLAH, it displays correctly but if i visit forums.php, nothing.

 

My initial thought was :

 

if(!$_GET && $_GET['page']){

 

But they contradict each other?

 

Is it possible or should i just place this in a separate php file ?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/105717-_get-problem/
Share on other sites

if (GET['page'])

should be

if ($_GET['page'])

 

personally i would do this

 

<?php
$page = (!empty($_GET['page']))?strtolower($_GET['page']):"";

switch($page)
{
default: //below is the defautl page
case "page1":
	echo "Page 1";
break;
case "page2":
	echo "Page 2";
break;
case "etc":
	echo "etc";
break;
}
?>

 

Link to comment
https://forums.phpfreaks.com/topic/105717-_get-problem/#findComment-541657
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.