I have a custom database table, location( id, country, city, latitude, longtitude )
2 page : country.php
(display all countries) and country detail.php
(display cities for each country in the dropdown) that my code in the pic work perfectly
But I want to display latitude and longtitude for city selected option in the field text
<select name="state" id="address" class="form-control">
Global $wpdb;
$code = get_query_var('country');
$result = $wpdb->get_results ( "SELECT city, latitude FROM location
WHERE country = '$code'");
foreach($result as $row) {
$city=$row->city;
?>
<option value="<?php echo $city; ?>"><?php echo $city; ?</option>
<?php
}
?>
</select>