MetalHawk
-
Posts
3 -
Joined
-
Last visited
Never
Posts posted by MetalHawk
-
-
include doesn't support full url, you have to use relative path for it instead. Example:
<?php $Page=$_SERVER['PHP_SELF']; $Filename="text.txt"; $RunType=1; $Number=5; include("../temp/includes/random.php"); ?> -
Hello!
I have a question related to switch case/include function in php.
<?php
switch($_GET['p'])
{
case "1": default: break;
case "2": die(include "concerts.php"); break;
case "3": die(include "reviews.php"); break;
default:
break;
}
; ?>
I have no trouble if I form a switch case & include with files that have extensions at the end, but I have a problem (include not working) if I try to include a page which doesn't have an extension (cms generated page).
I want to know is it possible, & if it, what should I change i next code, to include files like these?
Here is the example of the non-working code. I tried with / & without on the begining, same result.
<?php
switch($_GET['p'])
{
case "1": default: break;
case "2": die(include "/?cat=123"); break;
case "3": die(include "/?cat=124"); break;
default:
break;
}
; ?>
Thanks for help.
Switch case problem
in PHP Coding Help
Posted
[code]<?php
switch($_GET['p'])
{
case "1": header("location:http://www.domain.com/?cat=123"); exit; break;
default: break;
}
; ?>[/code]
thanks for help!