I have a list of areas (1000+) and i was wondering if there was a way i can do this easier with code instead of repeating each value.
foreach ($areas as $key => $val) { $select.= ' $valselected) { $val_fetch_from_array = $valselected == $val['campaignid'] ? 'selected' : ''; $select.= $val_fetch_from_array; // codes for selecting multiple values } $select.= ' value = "' . $val['campaignid'] . '">#' . $val['campaignid'] . '-' . $val['campaignname'] . ''; // closing the option tag }