title: Table row populated by drop down selection
body: <p>i have a drop down list populated from a database(it is the first cell in a table row) then based on that selection i want it to populate the rest of the row from the same database, each cell is a different table in the database, so  far i only have it populating the first cell (calories), i can't figure out how to get it to populate the rest of the cells, thanks</p>
  
  <pre><code>&lt;?php
  $link=mysqli_connect("localhost", "root", "");
  mysqli_select_db($link,"meal_planner");
  ?&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Meal Planner&lt;/title&gt;
      &lt;link href="main2.css" rel="stylesheet" type="text/css" /&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
        jQuery(document).ready(function($){
  
          // Hide all panels to start
          var panels = $('.accordion &gt; dd').hide();
  
          // Show first panel on load (optional). Remove if you want
          panels.first().show();
  
          // On click of panel title
          $('.accordion &gt; dt &gt; a').click(function() {
            var $this = $(this);
  
            // Slide up all other panels
            panels.slideUp();
  
            //Slide down target panel
            $this.parent().next().slideDown();
  
            return false;
          });
        });
      &lt;/script&gt;
  &lt;script&gt;
  function showUser(str) {
      if (str == "") {
          document.getElementById("txtHint").innerHTML = "";
          return;
      } else { 
          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 (this.readyState == 4 &amp;&amp; this.status == 200) {
                  document.getElementById("txtHint").innerHTML = this.responseText;
              }
          };
          xmlhttp.open("GET","getuser.php?q="+str,true);
          xmlhttp.send();
      }
  }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;dl class="accordion"&gt;
        &lt;dt&gt;&lt;a href=""&gt;Monday&lt;/a&gt;&lt;/dt&gt;
        &lt;dd&gt;
        &lt;table&gt;
      &lt;tr&gt;
        &lt;th&gt;Breakfast&lt;/th&gt;
        &lt;th&gt;Calories&lt;/th&gt;
        &lt;th&gt;Protein&lt;/th&gt;
        &lt;th&gt;Carbs&lt;/th&gt;
        &lt;th&gt;Fat&lt;/th&gt;
        &lt;th&gt;Serving Sizing&lt;/th&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
      &lt;td&gt;
      &lt;select name="breakfa"s onchange="showUser(this.value)"&gt;
       &lt;option value=""&gt;Select a Protein:&lt;/option&gt;
       &lt;?php
       $res=mysqli_query($link,"select name, protein_id from protein");
       while($row=mysqli_fetch_array($res))
       {
       ?&gt;
       &lt;option value="&lt;?php echo $row["protein_id"]; ?&gt;"&gt;&lt;?php echo $row["name"]; ?&gt;&lt;/option&gt;
       &lt;?php
       }
       ?&gt;
  
       &lt;/select&gt;
      &lt;/td&gt;
      &lt;td&gt;&lt;div id="txtHint"&gt;&lt;b&gt;0&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;
      &lt;td&gt;50&lt;/td&gt;
      &lt;td&gt;50&lt;/td&gt;
      &lt;td&gt;50&lt;/td&gt;
      &lt;td&gt;&lt;input type="" name=""&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
    &lt;/dd&gt;
  
        &lt;dt&gt;&lt;a href=""&gt;Tuesday&lt;/a&gt;&lt;/dt&gt;
        &lt;dd&gt;TEST&lt;/dd&gt;
  
        &lt;dt&gt;&lt;a href=""&gt;Wednesday&lt;/a&gt;&lt;/dt&gt;
        &lt;dd&gt;TEST.&lt;/dd&gt;
      &lt;/dl&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>php  </p>
  
  <pre><code>&lt;?php
  $q = intval($_GET['q']);
  
  $con = mysqli_connect('localhost','root','','meal_planner');
  if (!$con) {
      die('Could not connect: ' . mysqli_error($con));
  }
  
  mysqli_select_db($con,"ajax_demo");
  $sql="SELECT * FROM protein WHERE protein_id = '".$q."'";
  $result = mysqli_query($con,$sql);
  
  
  while($row = mysqli_fetch_array($result)) {
      echo "&lt;tr&gt;";
      echo "&lt;td&gt;" . $row['calories'] . "&lt;/td&gt;";
      echo "&lt;/tr&gt;";
  }
  echo "&lt;/table&gt;";
  mysqli_close($con);
  ?&gt;
  </code></pre>