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>
EDIT: I'll break the second part into another question.
The selected option(s) will have the attribute
selected="selected", so do a check during your loop and conditionally add this attribute:I could use some clarification on the second part. What defines whether or not an item is in the estimate?