I already use multiple dropdown box with data from MySQL database, but I face problem when I try to $_POST it. This is the code I use:
<?php try {
$dbo = new PDO('mysql:host=' . $dbhost_name . ';dbname=' . $database, $username, $password);
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
$sql = "SELECT city FROM dropdown";?>
<select name="cities" multiple="multiple">
<?php foreach ($dbo->query($sql) as $row) {
echo "<option value=>$row[city]</option>";
}
?>
</select></td>
This is the code I try to call it:
$test = $_POST['cities'];
echo $test;
- The data successfully imported from database but it's doesn't $_POST