CodeIgniter Forums
view receives different parameters before and after sending the form. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: view receives different parameters before and after sending the form. (/showthread.php?tid=58184)



view receives different parameters before and after sending the form. - El Forum - 05-22-2013

[eluser]Alejandrito[/eluser]
For some unknown reason (to me), when I load the page the view gets all the correct parameters, no errors, but when I send the form, I get a lot of errors that shouldn't be there (duh!) and I don't know why.

In both cases, the data "should" be the same (as far as I know).

Maybe you can give just a hint on where my error is?

Thanks!

This is my controller:
Code:
$this->form_validation->set_rules($reglas_validacion);
  $this->form_validation->set_error_delimiters('<br /><span><i class="icon-fire"></i>', '</span>');
  
  
   $datos['ingresos']  = $this->mod_ingresos->todos();
   $datos['igvpagado']  = $this->mod_gastos->igv();
   $datos['igvrecibido'] = $this->mod_ingresos->igv();
  
  // Si no pasa la validación de datos:
  // echo var_dump($datos);
  if ($this->form_validation->run() == FALSE)
  {  
   $this->load->view('ingresos_view', $datos);
  }
  else
  {
   // llenamos los datos para mandar al model
   $datos = array(
       'fecha'   => set_value('fecha')   ,
       'tipodocumento' => set_value('tipodocumento') ,
       'serie'   => set_value('serie')   ,
       'documento'  => set_value('documento')  ,
       'tipoingreso' => set_value('tipoingreso')  ,
       'cliente'  => set_value('cliente')   ,
       'descripcion' => set_value('descripcion')  ,
       'precio'  => set_value('precio')
       );
   // echo "<p>var_dump(datos)" . var_dump($datos). "</p>";
   if($this->input->post('submit'))
   {
                $this->mod_ingresos->agregar($datos);
                $this->load->view('ingresos_view', $datos);
            }
         }
and this is my view:

view file


view receives different parameters before and after sending the form. - El Forum - 05-23-2013

[eluser]Alejandrito[/eluser]
for those you want to know, I solved this by using FormIgniter so I avoided any simple error I could have (actually I had).

Anyways, thanks.