Jump to content

include query string file - failed


lard

Recommended Posts

Hi

 

I've got a page that includes a file according to the query string. I'd like to display a custom message rather than the normal php error messages. So what I currently have is:

<?php $path=$_SERVER['QUERY_STRING']; include("$path.php"); ?>

I was hoping to be able to do something like this, but obviously it doesn't work...

<?php 
$path=$_SERVER['QUERY_STRING'];
if (!$path)
  {
  echo "Sorry, that page cannot be found";
  }
include("$path.php"); 
?>

Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/146192-include-query-string-file-failed/
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.