CodeIgniter Forums

Full Version: Set a lebel value
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[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?

El Forum

[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