CodeIgniter Forums
Passing parameter by form_open - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Passing parameter by form_open (/showthread.php?tid=54322)



Passing parameter by form_open - El Forum - 09-03-2012

[eluser]Diegosf93[/eluser]
Hi, i have this issue, first i show the code and then explain it:

Code:
<div>
<div> &lt;?php echo $error ?&gt;</div>
&lt;?php $atributos = array('id' => 'form_operador');
echo form_open("Panel_Admin/Alta_OperadorE",$atributos); ?&gt;

Here is a bit piece of the view code of my site that call a method of the controller Panel_Admin call Alta_Operador.

I want to have a method that receive an $error parameter that indicate if is it an error in the form validation or not, but i dont know how to pass by the form_open an empty text to the first load of the form.

So i have 2 method that make the same but one show an error an another i use when i load the page and this not seems so good.

Thanks sorry for my english.


Passing parameter by form_open - El Forum - 09-03-2012

[eluser]TWP Marketing[/eluser]
[quote author="Diegosf93" date="1346706884"]Hi, i have this issue, first i show the code and then explain it:

Code:
<div>
<div> &lt;?php echo $error ?&gt;</div>
&lt;?php $atributos = array('id' => 'form_operador');
echo form_open("Panel_Admin/Alta_OperadorE",$atributos); ?&gt;

Here is a bit piece of the view code of my site that call a method of the controller Panel_Admin call Alta_Operador.

I want to have a method that receive an $error parameter that indicate if is it an error in the form validation or not, but i dont know how to pass by the form_open an empty text to the first load of the form.

So i have 2 method that make the same but one show an error an another i use when i load the page and this not seems so good.

Thanks sorry for my english.[/quote]
Use the hidden input type
Code:
&lt;?php $atributos = array('id' => 'form_operador');
$hidden = array('error' => $error);
echo form_open("Panel_Admin/Alta_OperadorE",$atributos,$hidden); ?&gt;
Hidden input vars will be returned by the form and may be accessed in your controller
Code:
$error = $this->input->post('error');



Passing parameter by form_open - El Forum - 09-04-2012

[eluser]john_j[/eluser]
http://ellislab.com/forums/viewthread/110735/#558708