Welcome Guest, Not a member yet? Register   Sign In
Hello how pass a var to controls from my form???
#1

[eluser]Unknown[/eluser]
Hello my friends

I have a little problem:

how pass a var to controls from my form on the view??
really i need this

thanks.
#2

[eluser]pickupman[/eluser]
What is an example of the code you are using? Passing variables from your controller is done by adding the variables to an associative array ie:
Code:
//Your controller Controller.php
$data['name_label'] = 'Name';
$data['name_value'] = 'My Name';

$this->load->view('form_view',$data);
Passing the $data array to the view, makes the array's keys availabe as variables in the view.
Code:
//Your view form_view.php
<label for="name">&lt;?=$name_label;?&gt;</label>
&lt;input name="name" type="text" value="&lt;?=$name_value;?&gt;" /&gt;
Produces:
Code:
//Renders in the browser
<label for="name">Name</label>
&lt;input name="name" type="text" value="My Name" /&gt;




Theme © iAndrew 2016 - Forum software by © MyBB