Hi,
I'm new in PHP and trying to build a dynamic web site for now. I use if statement to include php files into my content div by this code.
<?php
$p = $_GET['p'];
if ( !empty($p) && file_exists('./pages/' . $p . '.php') && stristr( $p, '.' ) == false )
{
$file = './pages/' . $p . '.php';
}
else
{
$file = './pages/home.php';
}
include $file;
?>
Everything is fine when I access web site with "?p=something" but when the URL is just index.php it says "Notice: Undefined index: p in C:\wamp\www\php_website\index.php on line 16". The line is the second written here in php code.
I got this code from here. What may be the problem?
Thanks.