Jump to content

Php problem after Php Update


ev5unleash

Recommended Posts

Hi, I've recently updated my PHP server and when I did this I've had a couple of problems with the script

 

	switch(strtolower($_GET['id']))  // 'content'

before when I used this code I didn't get a notice message of an Undefined index. Does anyone have an alternative code for this one?

 

Currently using: 5.2.8

 

Full PHP Code

 

 <?php 

include('./indextop.php'); // header

switch(strtolower($_GET['id']))  // 'content'
{
	case "page2":
	    include("pages/page2.php");
	break;
	case "spage1":
	    include("pagespage1.php");
	break;
	default:
	    include("indexhome.php");
	break;
}

include('./indexbottom.php'); // footer
?>

Link to comment
https://forums.phpfreaks.com/topic/143552-php-problem-after-php-update/
Share on other sites

I would normaly use something like this:

 

if( !isset($_GET['id']) )
{
    $xid = 'default';
}
else
{
    $xid = strtolower($_GET['id']);
}
switch($xid)
{
case 'default':
  include('indexhome.php');
break;
case 'page2':
  include('pages/page2');
break;
case 'spage1:
  include('pagespage1.php';
break;
}

include('./indexbottom.php');

  • 3 weeks later...

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.