title: Dynamic dropdown list fetching data from MYSQL
body: <p>I have been trying to create a form with dynamic dropdown list fetching data from MYSQL. My database is fine without errors. I have been trying to make it work, the page does not take data from mysql, what's wrong with my code? The table is called 'table' and the column is called "name", there are three inputs "name1", "name2", "name3", but they are not fetched from mysql. Thank You.</p>
  
  <pre><code>&lt;?php
      $link=mysqli_connect("localhost","root","");
      mysqli_select_db($link,"dropdown");
      if (!$link) {
          echo "Error: Unable to connect to MySQL." . PHP_EOL;
          echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
          echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
          exit;
      }
      echo "Connection is active" . PHP_EOL;
      echo "Host information: " . mysqli_get_host_info($link) . PHP_EOL;
      ?&gt;
      &lt;!DOCTYPE html&gt;
      &lt;html&gt;
      &lt;head&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;form name="form" action="" method="post"&gt;
              &lt;select&gt;
                  &lt;?php
                  $res = mysqli_query($link, 'SELECT name FROM table');
                  while($row = mysqli_fetch_array($res))
                  {
                      ?&gt;
                      &lt;option&gt;&lt;?php echo $row['name'];?&gt;&lt;/option&gt;
                      &lt;?php
                  }
                  ?&gt;
              &lt;/select&gt;
          &lt;/form&gt;
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>