How do I populate these fields from existing data?
- by dmanexe
I'm not sure how to make a few parts of my form to populate from data from an array I'm passing from the database.
First is this <select> object. The key estimate_lead_id in the database holds the value, and I want the dropdown to auto-select based on the value from the database.
<select name="estimate_lead_id">
<? foreach($leads->result() as $lead) { ?>
<option value="<?=$lead->id?>"><?=$lead->lead_name?></option>
<? } ?>
</select>
Second (this is a little more complex), I have created a script that loops through and gets all of the items from each respective category.
What I can't get it to do though is loop through these items and only display the items in the estimate, and then fill the fields with the respective values from the database.
<?php foreach ($items['items_poolconcretedecking']->result() as $item) { ?>
<input type="checkbox" name="measure[<?=$item->id?>][checkmark]" value="<?=$item->id?>">
<input class="item_mult" value="" type="text" name="measure[<?=$item->id?>][quantity]" />
<?php } ?>