CodeIgniter Forums
Set a lebel value - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: Set a lebel value (/thread-29613.html)

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

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:
<label>&lt;?php echo $value_from_db; ?&gt;</label>

Or, if you prefer the form helper:

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

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