title: When text box is length is 0 change HTML table td color?
body: <p>I'm trying to make a table change a td depending on what is in my text document. If the doc is empty I want it to have a white background with black text, but if there is content inside the document then set the background to grey with white text. It also echos what's in the document in the second td. It works if there is something in the document but if I change the document to "" it works but if I use my text box to set this value by clearing it with back spaces it doesn't work. The td is still grey with white text even know there isn't anything being display in it. Anyone got any ideas here?</p>
  
  <p><strong>Text Box Setter</strong></p>
  
  <pre><code>&lt;?php
  $tb = $_POST['spo']."\r\n";
  
      if (isset($_POST['submit'])){
          $myFile=fopen("DATA/Spo.txt","w") or exit("Can’t open file!");
          fwrite($myFile, $tb);
          fclose($myFile);
          header("Location: SeniorManagersSiteTour.php");
  
      }
  ?&gt;
  &lt;body&gt;
      &lt;h1 align="center"&gt;Site / Project / Office&lt;/h1&gt;
      &lt;form action="SiteProjectOffice.php" method="post" enctype="multipart/form-data" name="FileForm" id="FileForm"&gt;
          &lt;input name="spo" type="text" size="size" maxlength="22" &lt;?php $myFile=fopen("DATA/Spo.txt","r") or exit("Can't open file!"); echo 'value="'.fgets($myFile).'"'; fclose($myFile); ?&gt;&gt;
  
          &lt;div id="btnDiv"&gt;
              &lt;input id="submit" name="submit" type="submit" value="Save"&gt;
          &lt;/div&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p><strong>$Spo</strong></p>
  
  <pre><code>$myFile=fopen("DATA/Spo.txt","r") or exit("Can't open file!");
  $Spo = fgets($myFile);
  fclose($myFile);
  </code></pre>
  
  <p><strong>Table</strong></p>
  
  <pre><code>&lt;table border="0" width="100%" &gt;
                      &lt;tr&gt;
                      &lt;td width="26%" height="20px" &lt;?php if (strlen($Spo) == 0){echo'bgcolor="#FFFFFF" style="color:black;"';}else{echo'bgcolor="999999" style="color:white;"';}?&gt;&gt;&lt;strong&gt;Site / Project / Office&lt;/strong&gt;&lt;/td&gt;
                      &lt;td width="26%" height="20px" onclick="location.href='SiteProjectOffice.php'"&lt;?php if (strlen($Spo) == 0){echo'bgcolor="#FFFFFF" style="color:black;"';}else{echo'bgcolor="999999" style="color:white;"';}?&gt;&gt;&lt;?php echo $Spo; ?&gt;&lt;/td&gt;
                      &lt;td width="21%" height="20px"&gt;&lt;strong&gt;Contract Number&lt;/strong&gt;&lt;/td&gt;
                      &lt;td width="27%" height="20px" onclick="location.href='ContractNumber.php'"&gt;&lt;?php $myFile=fopen("DATA/Cont.txt","r") or exit("Can't open file!"); echo fgets($myFile); fclose($myFile); ?&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                      &lt;td height="20px" &gt;&lt;strong&gt;Site Manager&lt;/strong&gt;&lt;td colspan="4" onclick="location.href='SiteManager.php'"&gt;&lt;?php $myFile=fopen("DATA/Site.txt","r") or exit("Can't open file!"); echo fgets($myFile); fclose($myFile); ?&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                      &lt;td height="20px"&gt;&lt;strong&gt;Job / Task Description&lt;/strong&gt;&lt;td colspan="4" onclick="location.href='JobTaskDescription.php'"&gt;&lt;?php $myFile=fopen("DATA/Job.txt","r") or exit("Can't open file!"); echo fgets($myFile); fclose($myFile); ?&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                  &lt;/table&gt;
  </code></pre>