I'm normally work with CFML but I've started to dig deeper into PHP.
I've been using the function "include" to pull in pages and I can't seem to find any information about a feature I need. I'm passing a variable in the URL containing information about what page I want to show:
include("pages/".$page.".php");
But if a page is requested that doesn't exist or a false variable is entered in the URL I want a specific page to be shown.
How do I pass a default variable like $page=main to output the main.php page. I know it can be done since the Neowin site does this for example.
Question
Grandaevus
Hi folks,
I'm normally work with CFML but I've started to dig deeper into PHP.
I've been using the function "include" to pull in pages and I can't seem to find any information about a feature I need. I'm passing a variable in the URL containing information about what page I want to show:
include("pages/".$page.".php");
But if a page is requested that doesn't exist or a false variable is entered in the URL I want a specific page to be shown.
How do I pass a default variable like $page=main to output the main.php page. I know it can be done since the Neowin site does this for example.
Thanks...
Link to comment
Share on other sites
3 answers to this question
Recommended Posts