PHP Include question

Ok Im tryin to load the page say… index.php?page=Contact

and I wanna use <? include ("templates/") ?>

But where it says i want that to pull from the address i thought it would be something like <?php include ($_GET[$page]); ?> but it doesnt seem to be working. So it would pull what ever page you request. ?page=News it will automaticly include the file.

Does anyone know?

check the securety of ur script:

u should call the includes (otherwise people might be able to view the source of

what habbens if i enter something like index.php?page=…/hiddendir/highsensitvefile


if(in_array($_GET[‘page’],$vailed)) include (‘template/’.$_GET[‘page’].’.inc.php’);

watch ur spelling (case) ‘contact’ is not the same as ‘Contact’

or u may wanna translate it using an array:

if(isset($page2include[$_GET[‘page’]])) include ($page2include($_GET[‘page’]));

Sponsor our Newsletter | Privacy Policy | Terms of Service