php – How to Change btn-color according to SQL database-ThrowExceptions

Exception or error:
<td><span class="btn btn-xs btn-primary" onclick="reviewLiveScholarship('<?php echo $ship->id;?>')">Review</span></td>

I need to change the button color according to the data from database, where required documents are there ( either 1 or 0).

This button directs into the result page where the documents where shown.

Code is written in CodeIgniter.

How to solve:

You can try something like this

$color = "background-color: #5cb85c;";
      }
      echo "<button class='ServiceOff btn glyphicon glyphicon-globe' name='on_off' value='".$token_id."' style='".$color." color: #fff;''></button>";
   } // <-- *** YOU NEED TO ADD THIS ***
} else {
  echo "Error";
}

Leave a Reply

Your email address will not be published. Required fields are marked *