插入最后一行的下拉菜单

I am new to php and dropdown menus, my query works, but when displaying it is always missing the last row entered. So if I have two rows entered, the drop down will only display one? What am I doing wrong?

     <?php
       require("********");

      $query=mysql_query("select * from types");

        echo "<table  >
          <tr align='left'>
          <th><font color='red'>Description</th>
          </tr>";

          $options='';

          while($dbfield = mysql_fetch_array($query))
          {
            $options .= '<option>'.$dbfield['Description'].'</option>';
            echo "
              <form method='post'>
          <td><select name='Description'><? echo $options; ?></select>
          </tr>";
  • You don't close (}) your while loop.
  • You're also not consistent with your table structure.
  • mysql_ functions are also deprecated.

    <?php
    
    require("********");
    
    $query=mysql_query("select * from types");
    
    echo "<form method='post'>
    <table>
    <tr align='left'>
    <th><font color='red'>Description</th>
    </tr>";
    
    $options='';
    
    while($dbfield = mysql_fetch_array($query)) {
        $options .= '<option>'.$dbfield['Description'].'</option>';
    }
    
    echo "<tr>
    <td><select name='Description'><? echo $options; ?></select>
    </tr>";