title: HTML/PHP Form Select Option with link to MySQL
body: <p>I followed a previous question on here to get a drop down with link to MySQL. It works without the form but with the form, all the <code>room_id</code>'s just scatter across one line and don't go in a drop down box. Any ideas on how to fix it? Thank you</p>
  
  <pre><code>//Creates a form for room_id
  echo "&lt;form action=''&gt;";
  echo "&lt;select name='room_id'&gt;";
  //Creates drop down box to show the current rooms vacant
  $sql = "SELECT * FROM room";
  $sql.= " WHERE room_vacant = 1";
  $stmt = $dbh-&gt;query($sql);
  echo "&lt;select name='room_id'&gt;";
  while($row = $stmt-&gt;fetch(PDO::FETCH_ASSOC)) {
      echo "&lt;option value='" . $row['room_id'] . "'&gt;" . $row['room_id'] . "&lt;/option&gt;";
  } //Closes drop down box
  echo "&lt;/select&gt;";
  
  //Submit button
  echo "&lt;input type='submit' value='Submit'&gt;";
  
  //Closes form
  echo "&lt;/form&gt;";
  </code></pre>