Hide notice in PHP

Asked

Viewed 280 times

0

My problem is this. I have the variables $qr1, $qr2 and $qr3, as you can see in the code below, which are only valid when I send the data via post. But I need them to be hidden so the user doesn’t think it was a mistake when he enters the page. How can I do this in this code?

<form class="recipiente coluna margem-topo-100" method="post">

  <input type="text" name="code" required />
  <input type="submit" value="Gerar QR Code" />
  <input type="hidden" name="gerar" value="s" />
</form>




  <?php

  if(isset($_POST['gerar'])) {



    require_once "phpqrcode/qrlib.php";

    $valor = $_POST['code'];

    $code = $valor;

    QRcode::png($code, "Imagem_QRCODE_L.png", QR_ECLEVEL_L, 3);
    QRcode::png($code, "Imagem_QRCODE_M.png", QR_ECLEVEL_M, 5);
    QRcode::png($code, "Imagem_QRCODE_H.png", QR_ECLEVEL_H, 10);

    $qr1 = '<img src="Imagem_QRCODE_L.png"/>';
    $qr2 = '<img src="Imagem_QRCODE_M.png"/>';
    $qr3 = '<img src="Imagem_QRCODE_H.png"/>';

  }
  ?>

<section class="texto-centro margem-topo-50">
  <?=$qr1?>
  <?=$qr2?>
  <?=$qr3?>
</section>
  • because it does not play the <section class="texto-centro margem-topo-50"> into the if? needs those separate variables even?

  • No, since I’m stupid and I didn’t think about it...

No answers

Browser other questions tagged

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