Welcome Guest, Not a member yet? Register   Sign In
drop down menus
#7

[eluser]mdowns[/eluser]
You can also prepare the options array in the model itself.

Code:
function getMyOptions()
{
  $this->db->select('sizedefinitions');
  $query=$this->db->get('definitions');
  $result = $query->result();
  $options = array();
  foreach($result as $item){
    $options[$result->sizedefinitions] = $result->sizedefinitions;
  }
  return $options;
}

Then when you pass it into the view all you have to do is:

Code:
<td align="right" width="120" class="forrowcolr">
    &lt;?php echo form_label('Size : ');?&gt;
  </td>
  <td align="left" class="forrowcolr">
    &lt;?php echo form_dropdown('size', $options);?&gt;
  </td>

This will make your views cleaner.

P.S. When posting code or markup, please use the code tag [ code ] (without spaces)


Messages In This Thread
drop down menus - by El Forum - 10-21-2008, 06:58 AM
drop down menus - by El Forum - 10-21-2008, 08:32 AM
drop down menus - by El Forum - 10-22-2008, 01:50 AM
drop down menus - by El Forum - 10-22-2008, 02:09 AM
drop down menus - by El Forum - 10-22-2008, 03:23 AM
drop down menus - by El Forum - 10-22-2008, 05:46 AM
drop down menus - by El Forum - 10-22-2008, 08:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB