<? if ($action == "home") { include ("main.php"); } elseif ($action == "legal") { include ("legal.php"); } ?> or you could just try <? include ("$action.php") ?> and just make sure the $action is the same name as the page your trying to include