CodeIgniter Forums
Set a lebel value - 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: Set a lebel value (/showthread.php?tid=29613)



Set a lebel value - El Forum - 04-15-2010

[eluser]HugoA[/eluser]
Hi! How can i set the value for a label?
I have done a query over a data base and i want a label to have the value i just search.

how can i do this?


Set a lebel value - El Forum - 04-15-2010

[eluser]Dan Horrigan[/eluser]
You need to provide information if you want a good answer (i.e. are you talking about a form label: "<label></label>"?).

I am going answer it assuming a few things:
1. You are trying to put the value from the database in a form label.
2. You already know how to inject data into a view (if not see the user guide).

It is pretty easy. In the view file just do this:
Code:
<label>&lt;?php echo $value_from_db; ?&gt;</label>

Or, if you prefer the form helper:

Code:
&lt;?php echo form_label($value_from_db, ''); ?&gt;

Please read the User Guide. It will answer 99% of your questions.


Dan