title: How to use CSS to style the results of a PHP echo?
body: <p>I am creating a search form for a packaging database and I have used CSS to style the HTML form that calls to the PHP page. I want to be able to style all the results from the PHP page using the same kind of CSS that styles the search form, as the PHP continues to echo the results as separate elements I want all of them to be displayed in separate little boxes. Is it as simple as I think it is e.g. just surrounding the PHP with  tags? As I am trying that currently but it doesn't seem to work. </p>
  
  <pre><code>   &lt;body&gt;
  
          &lt;?php
              $con = mysql_connect ("localhost", "root", "");
                     mysql_select_db ("delyn_db", $con);
  
              if (!$con)
                  { 
                      die ("Could not connect: " . mysql_error());
                  }
  
              $descrip = mysql_real_escape_string($_POST['descrip']); 
              $depth   = mysql_real_escape_string($_POST['depth']);
  
              $varWidth = mysql_real_escape_string($_POST['traywidth']);
              $varHeight= mysql_real_escape_string($_POST['trayheight']);
              $varRange = mysql_real_escape_string($_POST['trayrange']);
              $varType  = mysql_real_escape_string($_POST['traytype']);
              $varShape = mysql_real_escape_string($_POST['trayshape']);
              $varImage = mysql_real_escape_string($_POST['imagename']);
  
              if (isset($varHeight) &amp;&amp; !empty($varHeight)) {
                      $low  = ($varHeight."00");
                      $high = ($varHeight."99");
                  } else {
                      $low  = ("000");
                      $high = ("999");
                  }
  
              if (isset($varWidth) &amp;&amp; !empty($varWidth)) {
                      $min  = ($varWidth."00");
                      $max = ($varWidth."99");
                  } else {
                      $min  = ("000");
                      $max = ("999");
                  }   
  
  
              $sql = "SELECT * FROM delyn WHERE 
                          description LIKE '%".$descrip."%'  
                      AND trayrange   LIKE '%".$varRange."%' 
                      AND traytype    LIKE '%".$varType."%' 
                      AND trayshape   LIKE '%".$varShape."%'
                      AND traywidth   BETWEEN '".$min."'  AND '".$max."' 
                      AND trayheight  BETWEEN '".$low."' AND '".$high."' ";
  
      ?&gt;
  
      while ($row = mysql_fetch_array($r_query)) 
                      { 
                          echo '&lt;p class="results"&gt;';
                          echo '&lt;br /&gt;&lt;img src="   '. $row['imagename'] . '" width="120" length="50"&gt;';
                          echo '&lt;br /&gt;&lt;strong&gt; Tool Code: &lt;/strong&gt;  '. $row['toolcode'];
                          echo '&lt;br /&gt;&lt;strong&gt; Description: &lt;/strong&gt; '. $row['description']; 
                          echo '&lt;br /&gt;&lt;strong&gt; Tray range: &lt;/strong&gt; '. $row['trayrange']; 
                          echo '&lt;br /&gt;&lt;strong&gt; Tray type:  &lt;/strong&gt; '. $row['traytype'];
                          echo '&lt;br /&gt;&lt;strong&gt; Tray size:  &lt;/strong&gt; '. $row['traysize']; 
                          echo '&lt;br /&gt;&lt;strong&gt; Tray shape: &lt;/strong&gt; '. $row['trayshape'] . '&lt;br /&gt;' . '&lt;br /&gt;' . '&lt;/p&gt;';;  
                      }
                  if (mysql_num_rows($r_query) &lt;= 0){
                      echo 'No results match your search, please try again';
                 }
  
          ?&gt;  
    &lt;/body&gt;  
  </code></pre>
  
  <p>CSS (For the HTML form, I want the same attributes for the Form div tag to work for the results):</p>
  
  <pre><code>  @charset "UTF-8";
  </code></pre>
  
  <p>/* CSS Document */</p>
  
  <pre><code> body {
  
  }
  
  .results {
  width: 190px;
  padding: 10px;
  background: #E8CF24;
  overflow:auto;
  display:block;
  
  font-family: Verdana, Geneva, sans-serif; 
  font-size: 11px;
  
  border: 1px solid #cccccc;
  -moz-border-radius: 7px;
  -webkit-border-radius: 7px;
  border-radius: 7px;
  
  -moz-box-shadow: 2px 2px 2px #cccccc;
  -webkit-box-shadow: 2px 2px 2px #cccccc;
  box-shadow: 2px 2px 2px #cccccc;
  }
  </code></pre>
  
  <p>Now EDITED.</p>