PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?php
function getMenu()
{
$thismenu="includes/menu/".$_GET['menu'].".inc";
include $thismenu;
}
$menu=$_REQUEST['menu'];
if ($menu == NULL) { $menu = "home";}
getMenu();
?>
If the URL is: http://www.domain.co.uk/index.php?page=home, shouldn't this pull in "home" as the menu file and place it in this section of the page?
If I set it to ".....index.php?page=home&menu=home", it works.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
<?php
function getMenu($menu)
{
$thismenu="includes/menu/".$menu.".inc";
include $thismenu;
}
$menu=$_REQUEST['menu'];
if (empty($menu)) { $menu = "home";}
getMenu($menu);
?>
Btw. its a terrible solution. It may seem secure with the path and file extension ... but it isnt. If you want to stay as simple as this, you'd better use switch/case.