title: Getting Data from PHP to work in HTML
body: <p>I have tried many things but none have been successful.  I am trying to get the Rating option to change after the box (Select to Pull Asset Center Data) is selected. It gets the data in the php file but I have no idea how to work with the data in the html file.</p>
  
  <p>Data
  servername  contact classification  rating
  Server1 Ray Production  A
  Server2 Eric    Non-Production  B</p>
  
  <blockquote>
    <p>--</p>
    
    <h2>-- Database: <code>ipreservation</code></h2>
    
    <hr>
    
    <p>--</p>
    
    <h2>-- Table structure for table <code>acdata</code></h2>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `acdata` (
    `servername` varchar(25) NOT NULL,
    `contact` varchar(20) NOT NULL,
    `classification` varchar(15) NOT NULL,
    `rating` varchar(4) NOT NULL 
  ) 
  ENGINE=InnoDB DEFAULT
  CHARSET=latin1;
  </code></pre>
    
    <p>--</p>
    
    <h2>-- Dumping data for table <code>acdata</code></h2>
  
  <pre><code>INSERT INTO `acdata` (`servername`, `contact`, `classification`,`rating`) 
  VALUES ('Server1', 'Ray', 'Production', 'A'),
  ('Server2','Eric', 'Non-Production', 'B');
  </code></pre>
    
    <p>/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT <em>/;
    /</em>!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS <em>/;
    /</em>!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;</p>
  </blockquote>
  
  <p>servertest.html</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script&gt;
  function showServer(str)
  {
  if (str=="")
    {
    document.getElementById("txtHint").innerHTML="";
    return;
    } 
  if (window.XMLHttpRequest)
    {// code for IE7+, Firefox, Chrome, Opera, Safari
    xmlhttp=new XMLHttpRequest();
    }
  else
    {// code for IE6, IE5
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  xmlhttp.onreadystatechange=function()
    {
    if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200)
      {
      document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
      }
    }
  var server = document.getElementById('existingserver').value;
  xmlhttp.open("GET","servertest.php?q="+server,true);
  xmlhttp.send();
  
  }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;form&gt;
  &lt;label&gt;Existing Server&lt;/label&gt;&lt;input type="text" name="existingserver" id="textfield" maxlength="15"/&gt;
  &lt;input type="checkbox" onclick="showServer(this.value)" &gt;Select to Pull Asset Center Data&lt;br&gt;
  &lt;br /&gt;
  &lt;br /&gt;
  Rating
  &lt;select name="rating" id="rating"&gt;
    &lt;option value="A"&gt;A&lt;/option&gt;
    &lt;option value="B"&gt;B&lt;/option&gt;
    &lt;option value="C"&gt;C&lt;/option&gt;
    &lt;option value="D"&gt;D&lt;/option&gt;
  &lt;/select&gt;
  &lt;/form&gt;
  &lt;br /&gt;
  
  &lt;div id="txtHint"&gt;&lt;b&gt;Server info will be listed here.&lt;/b&gt;&lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt; 
  </code></pre>
  
  <p>servertest.php</p>
  
  <blockquote>
    <code>$con = mysql_connect('localhost', 'assignip', 'assignip');
  if (!$con) {
     die('Could not connect: ' . mysql_error());
  } 
  </code>
    
    mysql_select_db("ipreservation", $con);
    
    $sql = "SELECT * FROM acdata WHERE servername = '".$q."'";
    
    $result = mysql_query($sql);
    
    echo "  Servername Contact
    Classification Rating ";
  
  <pre><code>while($row = mysql_fetch_array($result))   {
      echo "&lt;tr&gt;";
          echo "&lt;td&gt;" . $row['servername'] . "&lt;/td&gt;";
          echo "&lt;td&gt;" . $row['contact']. "&lt;/td&gt;";
          echo "&lt;td&gt;" . $row['classification'] . "&lt;/td&gt;";
          echo "&lt;td&gt;" . $row['rating'] . "&lt;/td&gt;";
      echo "&lt;/tr&gt;";   
  } 
  echo "&lt;/table&gt;";
  </code></pre>
    
    mysql_close($con); ?>
  </blockquote>