I am trying to include different header files based on the variable passed from another page. The variable is $section. Here is my code:
<?php include("header".$section.".php"); ?>
I am trying to include headerAbout.php or headerMenu.php or…. based on the variable $section. But I am getting an error:
include(header.php) [function.include]: failed to open stream: No such file or directory
I dont know why the variable is not being concatenated. can someone clarify this?
Given that it’s not being concatenated, the variable’s not defined at the point you try to use it in the include. Where are you setting its value?