What am I doing wrong? I have 4 salesman ID's and the cities they cover in an array called "cities". How do I obtain the Salesman ID based on the city entered in a form, Field-name "city"? I don't know how to search through an array inside of another array.
PHP:
$cities = array (
0 => array("Aldenville", "Analomink"),
1 => array("Abington", "Ambler", "Ardmore", "Avondale"),
2 => array("Ackermanville", "Albrightsville", "Allens Mills", "Alpha"),
3 => array("Adamstown", "Alburtis", "Allentown"));
if (($key = array_search($_POST['city'], $cities)) === false) {
echo "Not found";
} else {
echo $key;
}