title: Adding background color to element within php if-statement
body: <p>I have the following code in which I want to add an element to my if statement, but I am unsure how to approach this. What I am looking to do is add a background-color to the else part of it. Within this:</p>
  
  <pre><code>else {
          $status_img = '&lt;img src="../icons/collection/checkmark.png" alt="Goal Complete"&gt;';
  }
  </code></pre>
  
  <p>So if <code>$status</code> is not 0, I want to set background color for the class <code>goal-box-right</code>.</p>
  
  <p>Is there anyway I can manipulate the CSS through php like this?</p>
  
  <pre><code>foreach ($rows as $row) {
              $status = $row['status'];
              if ($status == 0) {
                  $status_img = '&lt;img src="../icons/collection/x-sign.png" alt="Goal Not Complete"&gt;';
              }
              else {
                  $status_img = '&lt;img src="../icons/collection/checkmark.png" alt="Goal Complete"&gt;';
              }
              $goal_date = $row['date'];
              $fixed_goal_date = fixDate($goal_date);
              $html = "";
              $html .= '&lt;div class="goal-box" id="comment-'.$row['id'].'"&gt;';
              $html .= '&lt;div class="goal-box-left"&gt;'; //added
              $html .= '&lt;div class="goal-post-status"&gt;'.$status_img. '&lt;/div&gt;';
              $html .= '&lt;/div&gt;'; //added
              $html .= '&lt;div class="goal-box-right"&gt;'; //added
              $html .= '&lt;div class="goal-post-title"&gt;'.$row['title']. '&lt;/div&gt;';
              $html .= '&lt;div class="goal-post-date"&gt;'.$fixed_goal_date. '&lt;/div&gt;';
              $html .= '&lt;div class="goal-post-description"&gt;'.$row['description']. '&lt;/div&gt;';
              $html .= '&lt;/div&gt;'; //added
              $html .= '&lt;/div&gt;';
  </code></pre>