Dynamically build page with PHP

Asked

Viewed 30 times

1

I need to display different pages according to a value that comes through the URI, I did this code, is not pointing errors, but also does not display the contents of H1.

<?php
  require_once"cabecalho.php";
  $plano = $_GET['plano'];
  if($plano == 'parcial'){ ?>
    <section class="plano-parcial">
      <h1>Plano parcial detalhes</h1>
    </section>
  <?php } ?>
  • Put these commands before the require_once and see if any errors will appear. error_reporting(E_ALL); ini_set('display_errors', 1);

  • Of the one var_dump() in $plano before the if() to see what the value of this variable may be a comparison error

1 answer

1


Put these commands before the require_once and see if any errors will appear.

error_reporting(E_ALL); 
ini_set('display_errors', 1);

I believe your require_once is failing, but you are not set to display errors and/or notices. This is the only possibility of not showing your H1 in your code, in addition to the obvious (I don’t think so) of not passing 'partial' in your GET

Browser other questions tagged

You are not signed in. Login or sign up in order to post.