How to create links like: something.php?id=something? Its very simple...
We create some page and in place where the content has to change you put this code:
Code:
<?php include("pages.php"); ?>
Now, to the pages.php you paste this first or this second:
Code:
<?php
switch ($_GET['id']) {
case ("index"):
include ("files/some_file1.php");
break;
case ("about"):
include ("files/some_file2.php");
break;
case ("guestbook"):
include ("files/some_file3.php");
break;
case ("other"):
include ("files/some_file4.php");
break;
default:
include ("some_file.php");
}
?>
OR
Code:
<?php
if($id=="index"){
include ("files/some_file1.php");
}
if($id=="about"){
include ("files/some_file2.php");
}
if($id=="guestbook"){
include ("files/some_file3.php");
}
if($id=="other"){
include ("files/some_file4.php");
}
if($id!="index" || $id!="about" || $id!="guestbook" || $id!="other"){
echo '<span>Error, no subpage like this!</span>';
}
?>
Wherever if you choose first or second yours links will look like this:
Also you create needed files (php), which are included in script (about including here.
Created by m1chu
|