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 :)

Recommended Answers

All 4 Replies

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

<?php

$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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.