Code design and structure
<p>It has recently been highlighted (in my previous questions) that the way I have designed web applications is not ideal.</p>

<p>Consider the following. I am working on a multi-user website with lots of different sections including profiles and forums and support tickets. The structure is as follows:</p>

<p>A main page in which all the other pages are <em>included</em> or *required_once* we'll call it <strong>home.php.</strong></p>

<p>In <strong>home.php</strong>, one of the first things loaded is <strong>router.php</strong>, this handles every single $_GET and $_POST that the user could possibly produce, and every form and process is sorted via a main variable called $data_process.  Router.php is essentially just one giant <strong>switch()</strong> statement for $data_process.  This parses all the data and gives a result.</p>

<p>Next included is <strong>header.php</strong>, which will not only process the neccessary variables for the page that will be loaded but also set up the header and decided exactly what is going to be shown there, e.g. menu, user info, and information about the page currently viewing (i.e. Home > Support > View Ticket).  </p>

<p>Then the page is loaded according to $page variable.  A simple include.</p>

<p>Then footer.php, then close.</p>

<p>And so the dynamic website is created.  I was told this is bad practice by a user named @HorusKol.  I am very pleased with this website as it is the most streamlined and easy to write website I have ever used.  If this is still bad code design? What is perfect code design?</p>

<p>PS - can anyone recommend any good easy to read books that explain PHP, MySQL and design structure for me?</p>
