View Full Version : Linking question:

02-24-2003, 11:57 PM
I've forgotten how to make links that use a page and then include information. Ok, so that wasn't clear at all, I'll try to explain:
Say I have a a page (index.php) and I want to keep the index layout on all my pages, so I have a link set up that will display the content wherever I want it on the page. When the link is placed, the adress will look like "index.php?inc=content". Once it hits that link, the layout will stay the same, but the content will change. I've done this before a long time ago, and since then I've deleted my examples. All I remember is that it involved this piece of code:

include($_GET['content'] . '.php');

I'm not sure if to some people it seems really obvious, but I'm not strong in php, and this may be all of the code I need, but I don't know how to use it properly.
Any help would be nice.

02-25-2003, 12:29 AM
Close :)


It's the value of inc you want, not content :)

Dylan Leblanc
02-25-2003, 12:45 AM
I would advise against doing that for security reasons.

At least validate the incoming data


if (in_array($_GET['inc'], array('array', 'of', 'valid', 'page', 'filenames'))) {