Sooraj Abbasi Sooraj Abbasi - 1 year ago 114
PHP Question

How to change the value of a Bootstrap progress bar using PHP

How can we change the value of Bootstrap progress bar by using PHP variables?
Here is my code so far:

echo "
<div class='progress'>
<div class='progress-bar progress-bar-success' role='progressbar' aria-valuenow='$paid_amount' aria-valuemin='0' aria-valuemax='$total_prize' style='width:$paid_amount%;'>

Answer Source

Try this,

$width = round(($paid_amount/$total_prize)*100,2);

echo '<div class="progress">
  <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'.$width.'"
  aria-valuemin="0" aria-valuemax="'.$total_prize.'" style="width:'.$width.'%">
    '.$width.'% Complete 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download