Below is a simple progress bar module I'm trying to create.
<?php
$progress = 3;
if($progress = 2) {
echo "<pre>progress 2";
var_dump($progress);
echo "</pre><br>";
$progressPrint = "
<div class='one progressBar'></div>
<div class='two progressBar'></div>
";echo $progressPrint;
}
elseif($progress = 3) {
echo "<pre>progress3";
var_dump($progress);
echo "</pre><br>";
$progressPrint = "
<div class='one progressBar'></div>
<div class='two progressBar'></div>
<div class='three progressBar'></div>
";echo $progressPrint;
}
elseif($progress = 4) {
$progressPrint = "
<div class='one progressBar progressBar'></div>
<div class='two progressBar'></div>
<div class='three progressBar'></div>
<div class='four progressBar'></div>
";echo $progressPrint;
}
else {
echo "nothing";
}
?>
The way it is set up for testing is a manual input of the $progress
variable. From there I'm testing against that integer. For some reason I can't get it to read to the $progressBar == 3
elseif
.
The var dump shows we're sticking in 2 when the variable is clearly 3.
As per OP's wish to close the question and be marked as solved:
You're assigning with all the if($progress =
instead of comparing if($progress ==