I'm not entirely sure what your general layout is, but if you're using PHP to generate the HTML select
tag, then you can try something like this:
$imei = $row["IMEI_MX"];
$imeiserial = explode(',', $imei);
echo '<select id="tags" name="imei" disabled class="form-control" onchange="getCount()" multiple>';
foreach($imeiserial as $is){
$wew = trim($is);
if (!empty($wew)) {
echo "<option value='$wew'>$wew</option>";
}
}
echo '</select>';
The PHP empty() function will return true
if the variable is NULL, an empty string, or does not exist. This means that if the value is a space (or empty string once the trim() function has gone through, then it won't output a html <option>
tag.
This is all assuming that you're meant to be creating a separate <option>
for each element in the array after an explode (I'm guessing it's a comma-separated list of IMEIs) but you were outputting the entire string as the value rather than just the element.
e.g.
<option value='867637026628082, 867637026628090'>867637026628082</option>
rather than
<option value='867637026628082'>867637026628082</option>