This is index file for my website. I want to load contact page but it doesn't work. How can I do with my code. Thank you
<?php $Page = (isset($_GET["p"])); include('includes/header.php'); if ($Page == "contact"){ include('pages/contact.php'); } else { include('pages/home.php'); } include('includes/footer.php');?>
isset results a boolean value, so $Page would be true
isset
$Page
true
Try this: $Page = isset($_GET["p"]) ? $_GET["p"] : null; Or $Page = $_GET["p"] ?? null;
$Page = isset($_GET["p"]) ? $_GET["p"] : null;
$Page = $_GET["p"] ?? null;
2.1m questions
2.1m answers
60 comments
57.0k users