Can anyone tell me how I would code links to other pages on my site (using php) whereby the full URL in the address bar looks like this:

http://www.mysite.com/index.php?id=3 (which points to blah.php)

I've done the usual searches on google and such with no luck on how to do it.

Mind you, I'm *not* a coder/webmaster so if you start talking about arrays and such, I'll have no idea what you're talking about :)

13 Years
Discussion Span
Last Post by kenleycapps

hmm. sounds to me like a simple include, but that's probably inefficient.


$pages = "/path/to/pages/";
$default = 1;

if(is_file($pages.$_GET['id'].".php")) $p = $_GET['id'];
else $p = $default;

include $pages.$p.".php";

Just have all your pages as ID numbers.. IE: news page = 3.html

But that's really inefficient, and probably not how you do it =P

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.