title: How do I echo SQL data from database table into a <select> form?
body: <p>I wonder if anyone can help.</p>
  
  <p>I am trying to echo some SQL data into a <code>&lt;select&gt;</code> form with each <code>&lt;option&gt;</code> as a different row from the table.</p>
  
  <p>For example if my table has two columns 'username' and 'category' and there are two rows for the same username, with the data:</p>
  
  <p>"username: test, category: test1."</p>
  
  <p>&amp; second row as:</p>
  
  <p>"username: test, category: test2."</p>
  
  <p>How could I echo 'test1' and 'test2' as two options in a select form?</p>
  
  <p>The table name is 'testtable' so my current <code>$sql</code> query is <code>("SELECT 'category' FROM 'testtable' WHERE 'username = \'$user\'")</code></p>
  
  <p><code>$user</code> is currently set to the <code>$_SESSION['username']</code></p>
  
  <p>Code examples would be really helpful and much appreciated. I just cant seem to get them to echo in examples I have found on forums.  </p>