• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
getting the select value

#1
[eluser]_Moat_[/eluser]
hello there,
i'm trying to get the value of the selected option on a drop down list.

what i do is:
view.php->
Code:
<select name="ID">
           <option value="0" >Chose a Category</option>
                    &lt;?php $i = 0; foreach ($frm5_ctg as $key) { ?&gt;
                    <option name ="test" value="&lt;?php echo set_value() == "" ? $frm5_ctg[$i]['ID'] : set_value('test');?&gt;">&lt;?php echo $frm5_ctg[$i]['CATEGORY_NAME'];?&gt;</option>
                   &lt;?php $i++;} ?&gt;
              </select>

next at the cntrler:
contrlr.php->
Code:
$data['frm5_ctg'] = $this->edit_page_db->getPageInfo("1,2,4,5,6,8,9,10");
$category = $this->input->post('ID');
$this->load->view('view', $data);
model->
Code:
public function getPageInfo($parentID)
{
  $sql = "select ID, CATEGORY_NAME from igs_page_category where CATEGORY_PARENT_ID in ($parentID)";
  $query = $this -> db -> query($sql,$parentID);
  if ($query -> num_rows() > 0)
   {
   foreach ($query->result_array() as $row)
   {
    $ctg_ids[] = $row;
    }
   return $ctg_ids;
  }
}
no when it loads it gives me the correct "ID's" from the db but the post value $category=0
so how can i retrieve the correct value.


Messages In This Thread
getting the select value - by El Forum - 07-12-2012, 10:56 AM
getting the select value - by El Forum - 07-12-2012, 01:02 PM
getting the select value - by El Forum - 07-12-2012, 01:03 PM
getting the select value - by El Forum - 07-12-2012, 01:07 PM
getting the select value - by El Forum - 07-12-2012, 01:07 PM
getting the select value - by El Forum - 07-12-2012, 01:26 PM
getting the select value - by El Forum - 07-12-2012, 01:42 PM
getting the select value - by El Forum - 07-12-2012, 02:46 PM
getting the select value - by El Forum - 07-12-2012, 02:59 PM
getting the select value - by El Forum - 07-12-2012, 03:03 PM
getting the select value - by El Forum - 07-15-2012, 04:45 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.