title: For loop with foreach loop in it? PHP
body: <p>I am trying to make the following happen.</p>
  
  <p>Go through a for loop and produce a set of 7 select boxes with time options in them. I have this loop working fine right now. This is for a form with times for start of an event for each day of the week. </p>
  
  <p>On user wanting to change the values, I would like to produce the same 7 boxes however foreach of the values entered in the database I would like to add the original selected value for that date, and provide the please select value for the of the boxes. </p>
  
  <p>foreach loop for the times</p>
  
  <pre><code>foreach ($times as $time) {
      echo '&lt;option value="' . $time['num'] . '"'; if ($event == $time['dec']){echo 'selected="selected"';};
              echo '&gt;';
              echo $time['clock'];
              echo '&lt;/option&gt;';
  }
  </code></pre>
  
  <p>Times Array</p>
  
  <pre><code>$times = array( array('num' =&gt; 70000, 'dec' =&gt; '07:00:00', 'clock' =&gt; '7:00am'), array('num' =&gt; 71500, 'dec' =&gt; '07:15:00', 'clock' =&gt; '7:15am') etc…
  </code></pre>
  
  <p>This produces the select options.</p>
  
  <p>Then the foreach to get the existing values.</p>
  
  <pre><code>foreach ($event -&gt; Selected as $select) {
     $event = $select -&gt; Start;
  }
  </code></pre>
  
  <p>This is all working right now but only produces say 3 selects if 3 records exist, I would like to produce 7 selects with the first 3 selects with the DB value, if 3 records exist and 4 empty selects</p>