I have a router.php file as below:
<?php
class router{
private $module_folder_name = "modules";
function Router(){
}
function Route()
{
$moduleValue = GetParam('module');
$folder = $this->module_folder_name;
if ($moduleValue == null):
{
header("location: index.php?module=main");
}
else:
{
switch ($moduleValue) {
case "main":
include_once $folder."/main.php";
break;
case "setting":
break;
default:
include_once $folder."/404.php"; //load 404 page
}
}
endif;
}
}
?>
and these functions:
<?php
function GetParam($param_name){
if (!empty($_GET[$param_name])) {
$value = $_GET[$param_name];
return $value;
}
else{
return null;
}
}
function PostParam($param_name){
if (!empty($_POST[$param_name])) {
$value = $_POST[$param_name];
return $value;
}
else{
return null;
}
}
?>
I want to conduct the user to index.php page when they don’t provide module name.
My code gives error as below:
Warning : Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\resume\panel\index.php:39) in C:\xampp\htdocs\resume\panel\controllers\router.php on line 13