Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.