Hi I'm reading PHP.net but I can't seem to find what I'm looking for, I assume it can be done I'm just not sure how any help would be great. Basically I'm trying to call an include within an include Check out the example and let me know if it can be done: From the main page set the variable: <?php $soda="Pepsi"; ?> <?php include("include/sodapage.php"); ?> Code (markup): On the Include (sodapage.php) Bunch of Information on Pepsi will be included on this page then a link to the different types of Pepsi Products for example Diet Pepsi, Mountain Dew ... <?php include("include/<?php echo $soda ?>lineup.php"); Code (markup): Should make the URL" include/Pepsilineup.php " but of course this doesn't work and I can't figure out how to make it work . ~Thanks in Advance
You can't nest <?php ... ?> blocks, just use PHP code within them. Its a simple string concatenation, use the dot operator. <?php include('include/' . $soda . 'lineup.php') ?> PHP: Be careful that the value of $soda is first validated against a list of allowable names, otherwise it is a security vulnerability.