well the topic tells it all, how to make those easy links like blah.php?id=01
instaed of /fsdf/fdsf/fds/bleh.php
thanks
how to make those easy links (like: blah.php?id=01)
Moderator: General Moderators
well, if you just have a few pages with your website you could use a switch:
You build your index.php for example like this:
in 1.php, 2.php, ... you put your content; in the header.php and footer.php you put your html-layout
Wasn't that hard, huh?!
You build your index.php for example like this:
Code: Select all
<?php
include("header.php");
//here your Menu with links like <a href="?id=1">page1</a>
switch ($_GETї"id"]) {
case 1: include("1.php"); break;
case 2: include("2.php"); break;
case 3: include("3.php"); break;
default: include("4.php");
}
include("footer.php");
?>Wasn't that hard, huh?!
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
If you wanted to then send people to another page entirely you would have to use header() to redirect them. So it's almost the same as bumpy's example, however, you wouldn't want any output whatsoever before the header() function call (viewtopic.php?t=1157)
Mac
Code: Select all
<?php
$id = (!empty($_GETї'id']) ? $_GETї'id'] : '';
switch ($id) {
case 'php':
header('Location: http://www.php.net/');
break;
case 'mysql':
header('Location: http://www.mysql.com/');
break;
default:
header('Location: http://www.mysite.com/');
}
?>