its not so secure version! Do not directly has the solotion to include a file with a GET link method.
anyway, you reach that variable from the link with $_GET
4 example
<?php
$inc["blog"]="blog.htm";
$inc["news"]="news.php";
$inc["register"]="register.html";
if(isset($_GET["variable_name"]) AND !empty($inc[$_GET["variable_name"]]) )
include( $inc[$_GET["variable_name"]]);
else
include("main.php"]);
?>
if you want to control which page you need to be include,
switch case is a good way. If you make a link, for example:
http://www.mysite.com/index.php?site=blog
then here is an example to a controlling php program.
<?php
$b="header.php";
$c="footer.php";
$d="navigation_bar.php";
switch($_GET["site"]){
case "add_user":
include("add_user.php");
//you might have pages that could not have html output
break;
case "register_form":
include($b);
include($d);
include("register_form.php");
include($c);
break;
case "news":
include($b);
include($d);
include("news.php");
include($c);
break;
default:
include($b);
include($d);
include("main.php");
include($c);
break;
} // switch
?>
But its a better version, if you make a database, with filenames and site_id -s.
If you like to know this method, i have an example 🙂
Hello,
jjozsi