Welcome Guest, Not a member yet? Register   Sign In
RadioButton not checked proper.
#1

[eluser]Rocky Mehta[/eluser]
I fetch all the data form the database. if condition true then my checkbox checked proper, but how can i radio button checked if condition true. AT line no 29 my radiobutton condition is true but not checked radio in browser
Controller page:
Code:
function main($venue_facilities_id = 0)
{
$this->load->model('venue_facilities_model');
$data = $this->venue_facilities_model->general();
  
if ($this->input->post('save'))
{
  if ($this->input->post('venue_facilities_id'))
  {
   $this->venue_facilities_model->do_upload();
   $this->venue_facilities_model->update_facility($_FILES['userfile']['name']);
   echo "Data Updated Successfully";
   redirect('http://localhost/venue/index.php/venue_facilities/update/');
  }
  else
  {
   $this->venue_facilities_model->do_upload();
   $this->venue_facilities_model->insert_facility($_FILES['userfile']['name']);
   echo "Data Inserted Successfully";
  }
}
if((int)$venue_facilities_id>0)
{
  $query = $this->venue_facilities_model->get($venue_facilities_id);
  $data['mvenue_facilities_id']['value']=$query['venue_facilities_id'];
  $data['venue_facilities_name']['value'] = $query['venue_facilities_name'];
  $data['venue_facilities_image']['value']=$query['venue_facilities_image'];
  [b]if($query['charges']=='free')   // if condition is true then radiobutton checked but not checked
  {
   //echo 'hiiiiiii';
   $data['charges']['checked'] = TRUE;
   echo set_radio('charges', 'free', TRUE);
  }[/b]
  if($query['charg']=='1')    //If condition true checkbox is checked this is workd.
  {
   $data['charg']['checked'] = TRUE;
  }
  else
  {
   $data['charg']['checked'] = FALSE;
  }    
}
$this->load->view('venue_facilities_view',$data);
}
view page:
Code:
<?php
  echo form_radio("charges", "free" );
  echo form_checkbox("charg",TRUE);
?>

How can i checked my radiobutton when fetching data from database?


Messages In This Thread
RadioButton not checked proper. - by El Forum - 02-27-2012, 03:47 AM
RadioButton not checked proper. - by El Forum - 02-27-2012, 04:03 AM
RadioButton not checked proper. - by El Forum - 02-27-2012, 04:30 AM



Theme © iAndrew 2016 - Forum software by © MyBB