I’m trying to create a dynamic webpage using include() in PHP.
This PHP page has the following codes – literally, that’s all the file contains:
<?php
session_start();
$dbName = $_REQUEST['DBName'];
$tbName = $_REQUEST['TBName'];
$dbType = $_REQUEST['DBType'];
include('header.php');
switch($dbType)
{
case 'Calender':
include('CalenderPage.php');
exit;
case 'News':
include('NewsPage.php');
exit;
case 'Gallery':
include('GalleryPage.php');
exit;
}
include('footer.php');
?>
Do you think it’s a good way of creating dynamic PHP page?
What you show is perfectly fine. It could be done a bit simpler using an array: