I want to display a drop-down list which pull out database values. My actual code working fine, but here I have to provide the list in the array itself. What i required is, without editing the code, i needed to pull out values from database to this array("state1","state2"....); which is equal to something like this array("$states");
$sql = "SELECT * FROM `States`";
$result = $conn->query($sql);
$i=0;
while($row = $result->fetch_assoc()) {
$t=$row['statename'];
$t[$i]=$row['statenname'];
$i++;
}
$countryArr = array( "INDIA" => array("$t"));
I tried the above code but its listing only one value from database.