I want to modify the maximum value of my progress bar

BrittingLee

Newbie
Messages
1
Likes
0
Points
1
Hello,

I'm making a progress bar that is getting its values from some variables I have declared. When my aria-value now meets my aria-value max, there is still space left over in the progress bar since it fills the width of it to only 80% and not 100%. So I'm kind of stuck on a fix for this. Here's my Code:
Code:
<i>
</i><?php 
      $current_players=$infosprp['players'];
      $max_players=$infosprp['places'];
      $width = $current_players;

      echo '<div class="progress w-25 m-auto" style="height: 30px;">
      <div class="font-weight-bold progress-bar bg-warning progress-bar-striped progress-bar-animated text-center" 
           role="progressbar" 
           aria-valuenow="'.$current_players.'"
           aria-valuemin="0" 
           aria-valuemax="'.$max_players.'"style="width:'.$width.'%;font-size:18px;">
           '.$width.'/'.$max_players.'
      </div>
    </div>'; 
?>
 
The width of the process bar is 100%. In your image displaying 80% completed, so you use a new variable like
Code:
$statusBar = ($current_players * 100) / $max_players;

Please see below example, I think it's should work for you.
Code:
<?php 
          $current_players=$infosprp['players'];
          $max_players=$infosprp['places'];
          $width = $current_players;
          $statusBar = ($current_players * 100) / $max_players;

          echo '<div class="progress w-25 m-auto" style="height: 30px;">
          <div class="font-weight-bold progress-bar bg-warning progress-bar-striped progress-bar-animated text-center" 
               role="progressbar" 
               aria-valuenow="'.$current_players.'"
               aria-valuemin="0" 
               aria-valuemax="'.$max_players.'"style="width:'.$statusBar.'%;font-size:18px;">
               '.$width.'/'.$max_players.'
          </div>
        </div>'; 
    ?>
 

Members online

No members online now.