• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
form set_value() not working ,,,,

#1
[eluser]Unknown[/eluser]
Hi ,

Im new to codeigniter and this is my first post.

This is part of my code.

Code:
<td>Brand Name &lt;?=$brand_name?&gt;
        &lt;input type="text" name="txf_brand" id="txf_brand" value="&lt;?php echo set_value('txf_brand', $brand_name); ?&gt;" /&gt;&lt;/td>

Basically , i want to display the value passed from controller in a text field. Im setting the value for this ($brand_name) variable in the Controller. The correct value is displayed near "Brand Name". But not inside the set_value method. This is strange .. can anyone pls help me.

Thanks

#2
[eluser]smilie[/eluser]
Hi,

set_value() is part of form validation.

If your value comes from controller, just use:
$brand_name;

Once your form has been processed and in case there are errors in the form, then you can use set_value('value_name') which will be 're-filled' on page reload.

Read the form validation in user manual.

Cheers,
Smilie

#3
[eluser]Unknown[/eluser]
Hi ,

Thanks. Your first line solved the problem :o)

It worked after loading the "form_validation" library. But still i don't understand why it didn't work even though i have loaded the "form" helper.

Form Helper has "set_value()" method, right ? i read the doc.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.