Динамический флажок и получить значения из флажка отмечен

У меня возникают трудности при создании динамических флажков из БД и получении значений из флажков, когда они отмечены.

У меня есть этот контроллер:

public function proporEvento(){

$natureza = $this->evento_model->naturezaEvento();
$apoio = $this->evento_model->apoioPertendido();
$espaco = $this->evento_model->espaco();
$material = $this->evento_model->material();
$suportgraf = $this->evento_model->suporteGrafico();
$audiovisual = $this->evento_model->audioVisual();

$data['title']              = 'Propor Evento';
$data['naturezaEvento']     = $natureza;
$data['apoioPertendido']    = $apoio;
$data['espaco']             = $espaco;
$data['material']           = $material;
$data['suporteGraf']        = $suportgraf;
$data['audioVisual']        = $audiovisual;



$this->load->view('cliente/clienteheaderdash_view', $data);
$this->load->view('cliente/clientemenu_view', $data);
$this->load->view('cliente/clienteproporevento_view', $data);
$this->load->view('cliente/clientefooterdash_view', $data);
}

Есть эта модель:

public function naturezaEvento(){
$query = $this->db->get('tblnaturezaevento');
return $query->result();
}

public function apoioPertendido(){
$query = $this->db->get('tblapoio');
return $query->result();
}

public function espaco(){
$query = $this->db->get('tblespaco');
return $query->result();
}

public function material(){
$query = $this->db->get('tblmaterial');
return $query->result();
}

public function suporteGrafico(){
$query = $this->db->get('tblsuportegraf');
return $query->result();
}


public function audioVisual(){
$query = $this->db->get('tblaudiovisual');
return $query->result();
}

…и у меня есть это мнение (одна часть, например):

<label>Apoio Pertendido</label>
<div class="form-group">
<?php foreach ($apoioPertendido as $row) { ?>
<label>
<input type="checkbox" class="flat-red" name="apoiopretendido[]" value="<?php   echo $row->idApoio  ?>" /> <?php   echo $row->descricao;  ?>
</label>
</br>
<?php }  ?>
</div>

этот код создает <input type="checkbox"...> правильно, но как я могу получить значения из флажка?

Моя форма, чтобы пойти с этой функцией контроллера:

 public function etapa2(){
//$this->load->library('form_validation');

// $this->form_validation->set_rules('naturezaEvento', 'naturezaEvento', '|required|');
//$this->form_validation->set_rules('denominacao', 'denominacao', '|required|');
// $this->form_validation->set_rules('datainicio', 'datainicio', '|required|');
// $this->form_validation->set_rules('horainicio', 'horainicio', '|required|');
// $this->form_validation->set_rules('datafim', 'datafim', '|required|');
// $this->form_validation->set_rules('datainicio', 'datainicio', '|required|');

//if($this->form_validation->run() == FALSE){
//$this->index();
//}else{

$datageral['idcliente'] = $this->session->userdata('idcliente');
$datageral['idnatureza']=$this->input->post('naturezaEvento'); //insere o id do campo natureza da tabela tblnaturezaevento
$datageral['denominacaotitulo'] =  $this->input->post('denominacao');
$datageral['datainicio']=$this->input->post('datainicio');
$datageral['horainicio']=$this->input->post('horainicio');
$datageral['datafim']=$this->input->post('datafim');
$datageral['horafim']=$this->input->post('horafim');
$datageral['planotrabalho']=$this->input->post('planotrabalho');
$datageral['raidertecnico']=$this->input->post('raidertecnico');
$datageral['programa']=$this->input->post('programa');
$datageral['mesa']=$this->input->post('mesa');
$datageral['notas']=$this->input->post('notas');
//'valorprovisorio' => $this->input->post('notas'), TODO fazer o valor provisório

//checkbox apoio
$apoiopertendido = $this->evento_model->apoioPertendido();
foreach ($apoiopertendido as $row) {
if ($this->input->post($row->checked, TRUE)===true){
$datageral[$row->tag] = $this->input->post($row->tag);
}
}

//checkbox espaços
$espacopertendido = $this->evento_model->espaco();
//$esp = array();
foreach ($espacopertendido as $row) {
if ($this->input->post($row->tag, TRUE)===true){
$datageral[$row->tag] = $this->input->post($row->tag);
}
}

//Material Necessário
$material = $this->evento_model->material();
//$materialnecessario = array();
foreach ($material as $row) {
$datageral[$row->tag] = $this->input->post($row->tag);
}

//checkbox suportes graficos
$suporteGrafico = $this->evento_model->suporteGrafico();
//$suporte = array();
foreach ($suporteGrafico as $row) {
if ($this->input->post($row->tag, TRUE)===true){
$datageral[$row->tag] = $this->input->post($row->tag);
}
}

//Registo Audio Visual
$audioVisual = $this->evento_model->audioVisual();
//$audiov = array();
foreach ($audioVisual as $row) {
if ($this->input->post($row->tag, TRUE)===true){
$datageral[$row->tag] = $this->input->post($row->tag);
}
}

$this->load->view('cliente/clienteheaderdash_view');
$this->load->view('cliente/clientemenu_view');
$this->load->view('cliente/clienteetapa2_view', $datageral);
$this->load->view('cliente/clientefooterdash_view');
// }
}

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector