php - Select multiple not working -
i have select dropdown in html won't select multiple values. here code have this:
<div class="col-sm-10"> <select multiple id="cmbservice" name="cmbservice" class="form-control" > <option value="0">- select 1 -</option> <?php try{ $dbhost = "localhost"; $dbuser = "mdchadmin"; $dbpass = "123456"; $dbname = "mdch_new"; $conn = new mysqli($dbhost, $dbuser, $dbpass, $dbname); if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } $sql = "select promo_number, promo_name promos status=1"; $result = $conn->query($sql); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { echo "<option value=\"{$row['promo_number']}\">{$row['promo_name']}</option>"; } } $conn->close(); }catch (exception $e) { echo 'error: ' . $e->getmessage(); } ?> </select> </div>
edit: works answer. have new problem(kinda) , i'm going thru this
so did u suggested, , im getting $customer array in other php file results to:
te,gian marco.'_'.1235 g,g.'_'.123 1235 , 123 data on mobile numbers column. problem , when $mobile=(explode("_",$customers)); doesn't give me when output via: foreach($mobile $z) { echo $z; echo "<br>";}
@identity unknown
you need add square bracket in name
attribute name="cmbservice[]"
<select id="cmbservice" name="cmbservice[]" class="form-control multiple " >
Comments
Post a Comment