-1

I have some variables in PHP that I pull out from a database. I want that a certain div in the page shows only when that variable pulls out a specific result.

I came across something like that but it doesn't work. Anybody can help me?

<?php  if ($piano == '7'){?>
  <script>
    $("#wellness").show();
  </script>
<?php } else { ?>
  <script>
    $("#wellness").hide();
  </script>
<?php } ?>


<div id="wellness">wellness</div>

1 Answers1

1
<?php  if ($piano == '7'){?>
  <div id="wellness">wellness</div>
<?php } ?>

Instead of using javascript you can use php IF condition to show it or not. Now the div will only show if $piano is 7

E3Im
  • 342
  • 2
  • 17