dimanche 26 janvier 2020

Using the results of an IF statement to effect 2nd IF statement

The results from the the first IF statement that puts out results. I would like to use the two outputted values to manipulate the second IF statement to either take the value of the $loadedWeightUSTons or $emptyWeight only one returns a value at any given time. I've tried using $loadWeightUSTons or $emptyWeight in each of the if or ifelse statments to no avail. Can some one be of assistance.

1st IF Statment

if ($loadWeightUSTons == 0) {
            echo "E";
        }else {
            echo "L";
        }
    echo "</td>";
    echo "<td>";
    if ($loadWeightUSTons == 0){
        $emptyWeight = "Not Found!";
        foreach($railunit->railUnit as $ru) {
            if((string)$ru->rvXMLfilename == $rvXMLfilename){
                $emptyWeight = (string)$ru->unitWeight;
            } 
        }
        echo $emptyWeight;
    }else{
      echo  $loadWeightUSTons;
            }

2nd IF Statment

if ($loadWeightUSTons <= 10) {
            echo "X";
        } elseif ($loadWeightUSTons <= 20){
            echo "XX";
        } elseif ($loadWeightUSTons <= 30){
            echo "XXX";
        } elseif ($loadWeightUSTons <= 40){
            echo "XXXX";
        } elseif ($loadWeightUSTons <= 50){
            echo "XXXXX";
        } elseif ($loadWeightUSTons <= 60){
            echo "XXXXXX";
        } elseif ($loadWeightUSTons <= 70){
            echo "XXXXXXX";
        } elseif ($loadWeightUSTons <= 80){
            echo "XXXXXXX";
        } elseif ($loadWeightUSTons <= 90){
            echo "XXXXXXXX";
        } elseif ($loadWeightUSTons <= 100){
            echo "XXXXXXXXX";
        } elseif ($loadWeightUSTons <= 110){
            echo "XXXXXXXXXX";
        } elseif ($loadWeightUSTons <= 120){
            echo "XXXXXXXXXXX";
        } elseif ($loadWeightUSTons <= 130){
            echo "XXXXXXXXXXXX";
        } elseif ($loadWeightUSTons <= 140){
            echo "XXXXXXXXXXXXX";
        } elseif ($loadWeightUSTons <= 150){
            echo "XXXXXXXXXXXXXX";
        }  else{
            echo "Error!";
        } 

Aucun commentaire:

Enregistrer un commentaire