Codeigniter set_value() and populate the form value
You can set them like this, if set_value('columnanme')
returns false
then a form $_POST
did not take place so what it will do is get the data from the data base example
$profile->firstname
$firstname = set_value('firstname') == false ? $profile->firstname : set_value('firstname');
$lastname = set_value('lastname') == false ? $profile->lastname : set_value('lastname');
Use it like:
echo form_label('Firstname', 'fname');
echo form_input('firstname', $firstname);
echo form_label('Firstname', 'lnamey');
echo form_input('firstname', $lastname);
in your case you can do:
$quantity = set_value('Quantity') == false ? $quantityx : set_value('Quantity');
ANd on your form:
echo form_label('Quantity', 'quantity');
echo form_input('quantity', $quantity);
Assuming that $quantityx
holds the data from your databse
EDIT
=============================================
Just use set_values()
second parameter as the default value. i.e set_value('name_of_input_field',$data_from_databse_as_default);
If this does not work, then use my first answer.
To populate the value below code worked for me.
form_input('cat_name','{YOUR VALUE}',array('id' => 'cat_name', ''placeHolder'' => 'Enter Cat Name'));