PHP script to include webpages with in a page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mikemxc
Forum Newbie
Posts: 1
Joined: Wed Apr 15, 2009 3:23 pm

PHP script to include webpages with in a page

Post by mikemxc »

Im sorry to ask im sure such a silly question. But, I can't for the life of me find the simple script to include a page with in one php page.

where you would use te url like http://anypage.com/index.php?id=signup

then the script would just include signup.php within index.php.


help please..

thanks
User avatar
andyhoneycutt
Forum Contributor
Posts: 468
Joined: Wed Aug 27, 2008 10:02 am
Location: Idaho Falls

Re: PHP script to include webpages with in a page

Post by andyhoneycutt »

You could accomplish something like that by using require, require_once, include, include_once -- but be sure to make sure the input from the url is solid and sanitized before issuing it into any if the above statements. I would recommend keeping a list of the pages that are acceptable to you as includes, either in a database, flat file, or array in the code itself to compare url input against.

-Andy
Post Reply