title: How can I create <select> optgroups in html using data from mysql?
body: <p>SO I have about 60 fields of data queried from a database. They look like this in page source:</p>
  
  <pre><code>    &lt;option&gt;Genesis&lt;/option&gt;
      &lt;option&gt;Exodus&lt;/option&gt;
      &lt;option&gt;Leviticus&lt;/option&gt;
  </code></pre>
  
  <p>For example I wanna have it so that 1-20 are a certain optgroup and then 20-60 is another. Could I do it using my format of options of would they have to be numbered like this:</p>
  
  <pre><code>&lt;option value="1"&gt;Genesis&lt;/option&gt;
  &lt;option value="2"&gt;Exodus&lt;/option&gt;
  &lt;option value="3"&gt;Leviticus&lt;/option&gt;
  </code></pre>
  
  <p>This is for my php class, but i dont think php is involved in making optgroups here, or is it? Thank you hope you understand my question. Hoping for help. </p>
  
  <p>I pull the data from mysql using this :</p>
  
  <pre><code>//Query the database for the results we want
  $query = $mysqli-&gt;query("select distinct bname as Name from kjv"); ?&gt;
  </code></pre>
  
  <p>And then output it in the select dropdown box using this:</p>
  
  <pre><code>    &lt;select&gt;
      &lt;?php while($option = $query-&gt;fetch_object()){ ?&gt;
          &lt;option&gt;&lt;?php echo $option-&gt;Name; ?&gt;&lt;/option&gt;
      &lt;?php } ?&gt;
  &lt;/select&gt;
  </code></pre>