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!
Wonder how to get this right. This is a part from the index.php of my website. This page should display the same header and footer to any $html page I have defined in index.php. I know the code is (very) wrong so, please help
<?php
$pagina = $_GET["pagina"];
if ($pagina=="") $pagina="Home";
if ($pagina="Home") $html="body.html";
if ($pagina="Contact") $html="contact.html";
?>
<?php
include "header.html"; // include header
if (!empty($_GET['pagina'])) { // check if it is set.
$pagina = $_GET['pagina']; // it is
} else {
$pagina = "Home"; // its not
}
if ($pagina == "Contact") { // show contact?
include "contact.html";
} else {
include "body.html"; // if not, default to this page
}
include "footer.html"; // include footer
?>