Home > Software design >  How to show div after if function using PHP?
How to show div after if function using PHP?

Time:05-01

I have a div that is initially hidden

<div  style="position:absolute; display:none;" >

I want to unhide it when my variable is "1". I currently have this code but it does not unhide the div.

<?php
if ($choice == "1"){
   ?>
   <style type="text/css">.create_member{
   display:block;
   }</style>
   <?php
   create_member($address_book);
}

How should I go about this?

CodePudding user response:

Use the !important property to override the existing style.

if ($choice == "1"){
   ?>
   <style type="text/css">
   .create_member{ display:block !important; }
    </style>
   <?php
   create_member($address_book);
}
  • Related