Welcome Guest, Not a member yet? Register   Sign In
Passing parameter by form_open
#1

[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.
#2

[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');
#3

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




Theme © iAndrew 2016 - Forum software by © MyBB