does anyone know the code in php to stay on the same page but switch content
like index.php?id=page1 and that shows page 1 and index.php?id=page2 shows page 2
does anyone know the code in php to stay on the same page but switch content
like index.php?id=page1 and that shows page 1 and index.php?id=page2 shows page 2
Found that on some website a long time ago. Can't remember where though.PHP Code:<?php
if (isset($_GET['id'])) $PAGE = $_GET['id'];
else $ID = 'home';
switch ($ID) {
//1- index
case 'home':
include ('home.tpl.php');
break;
//2- something else
case 'home':
include ('home.tpl.php');
break;
default:
echo "<p align=center>Error 404!<br><br>The page you request doesn't exist!</p>";
break;
}
?>
Last edited by Christopher; 11-22-2007 at 10:20 PM.
thanks =)
Edit:
the code didnt work
when i load the pag it says could not load directory in home/...
Last edited by coolv1994; 11-22-2007 at 11:15 PM. Reason: Automerged Doublepost
Hello,
You can also use the following :
NaBiLCode:<?php if(!$_GET['id']) include('home.php'); if($_GET['id'] == 1) include('page1.php'); if($_GET['id'] == 2) include('page2.php'); ?>
"It's choice not chance that determines your destiny."
omg thx tht 1 really works