View Full Version : Help Needed on PHP

11-12-2006, 09:24 PM
I would like to have a page called something like site.php or site.html. Then, after that, I want to be able to do something like ?id=345 (www.mydomain.com/site.php?id=345) and go to a different page that ?id=235. (www.mydomain.com/site.php?id=235) How would I go about doing that? Can you possibly also give me a link to a tutorial telling me how to do that?

11-12-2006, 10:17 PM
Your main page ( "index.php" )is:

<head><title>main page</title></head>
<a href='site.php?id=200'>Page 2</a><br />
<a href='site.php?id=300'>Page 3</a><br />
<a href='site.php?id=400'>Page 4</a><br />

Here is your page called 'site.php' ...

if($id == 200){$location="http://www.mysite.com/";}
if($id == 300){$location="http://www.mysite2.com/";}
if($id == 400){$location="http://www.mysite3.com/";}
header ("location: $location");


With that said, you should explain in more detail what your goal is ...

there might be a better solution than what you're describing.

You can give your webpage an extension of .php and do "PHP includes",
and dynamic creation of pages ... mixing HTML and PHP in the same page.
Using PHP for dynamically created pages is extremely powerful.


Here's an example of what I'm talking about. By using PHP Includes, each
page is dynamically generated by text files (the content). Notice that
the pages are all the same URL with a different "page" variable assigned.
That page variable determines which text file (HTML source) to include
in the content.

A working example of what I mean: http://www.palosantodesigns.com