title: view my updating data from mysql to dropdown list
body: <p>I want to view some foods which I added through html and php code into database
  like food a, food b, food c, food d.</p>
  
  <p>I want to view these food category in my dropdown list in another page of html as a updating food category .</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
  $db_host = 'localhost'; // Server Name
  $db_user = 'root'; // Username
  $db_pass = ''; // Password
  $db_name = 'rfid'; // Database Name
  
  $conn = mysqli_connect($db_host, $db_user, $db_pass, $db_name);
  if (!$conn) {
   die ('Failed to connect to MySQL: ' . mysqli_connect_error()); 
  }
  
  ?&gt;  
    &lt;div class="sign_up"&gt;
    
      &lt;div class="formtitle" align="center"&gt;View Food Items &lt;/div&gt;
      &lt;div class="top_section"&gt;
       &lt;div class="section"&gt;
       &lt;br&gt;
        &lt;div class="input-sign details2"&gt;
        &lt;form name="form1" action="" method="post"&gt;
         &amp;nbsp;&amp;nbsp; View Foods: 
           &lt;?php
          if ($result = @$dbconn-&gt;query("SELECT * FROM `food`")) 
          {
          //`food` represents the table name.
            echo "&lt;select&gt;";
            while ($row = $result-&gt;fetch_assoc()) 
      {
              echo "&lt;option value=\"".$row["food"]."\"&gt;".$row["food"]."&lt;/option&gt;";
              /*"id" and "foodname" represents the table column name.*/
            }
            echo "&lt;/select&gt;";
          }
         ?&gt;
         &lt;select&gt;
          &lt;option&gt;&lt;?php echo $row["food"];?&gt;&lt;/option&gt;
         &lt;/select&gt;
         
         &lt;/form&gt;
        &lt;/div&gt;      
       &lt;/div&gt;    
       &lt;/div&gt;
   &lt;div class="clear"&gt; &lt;/div&gt;
    &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>