Page 1 of 1

Include a page based on ID.

Posted: Thu Dec 11, 2008 1:09 pm
by Burst404
Now, I don't know if this is possible, but it would be awesome if it were...

I have a page, and I'd like to include an additional page using IDs...

Example:

example address:

Code: Select all

hxxp://www.example.com/image.php?id=2008-12-11a

code should then pull:

Code: Select all

<?php include("media/posts/(($ID)).php"); ?>
Whereas (($ID)) would be the id above...

Is this possible?

Thanks in advance.

Re: Include a page based on ID.

Posted: Thu Dec 11, 2008 1:15 pm
by Eran
yep, it's possible. Url parameters are stored in the superglobal $_GET array. Make sure to filter and validate any data passed through it as to avoid having your script exploited.

Re: Include a page based on ID.

Posted: Thu Dec 11, 2008 1:22 pm
by Burst404
What would be the code to do such a thing? To be honest, I'm rather new to PHP.

Re: Include a page based on ID.

Posted: Thu Dec 11, 2008 1:26 pm
by Eran
Google 'php $_GET tutorial' and get cracking. If you encounter problems while trying to learn, come back here and we'll help you with specific questions.

Re: Include a page based on ID.

Posted: Thu Dec 11, 2008 1:27 pm
by Burst404
Actually, thank you so much! I like to research my own code, but no matter what I searched for, google wouldn't return anything.

Again, thank you... I may be back...