I have one form that is used to add and edit something. On the form is a select tag. What I’m asking is where do I use an if statement in this to see if its the edit then to preselect a value preset for the form.
Example below is what is needed for general add form:
<select name="item_status" id="select1" class="nostyle" style="width:100%;" placeholder="Select Status">
<option></option>
<?php foreach($something AS $item)
{
echo '<option value="'.$item->item_id.'">'.$item->items_name.'</option>';
}
?>
</select>
1 Answer