I am trying to show dropdown values given in MySQL via PHP dynamically. The options are coming up properly but when selecting a value and submitting the form, the value which has two words with space is saving only the first word but not the whole word.
For Eg:
Select Cars:
The dropdown has the following taken from MySQL:
Volvo XC90
Saab 95
Mercedes SLK
Audi TT
When I select Volvo XC90 and submit the form, data gets saved to DB with a value just Volvo I don't XC90.
Not sure why it is not taking white space.
PHP code that pulls data dynamically from DB:
<select name="user_zone" class="form-control ">
<?php
$zone_query = "SELECT * FROM zone_details ORDER BY zone ASC;";
$zoneresult = mysqli_query($bd,$zone_query);
while($r = mysqli_fetch_assoc($zoneresult))
{
if ($user_zone == $r['zone'])
{
$selected = 'selected="selected"';
}
else {
$selected = '';
}
echo "<option ".$selected." value=".$r['zone'].">".$r['zone']."</option>"; }
?>
</select>