Here s the code: I could find nothing as to why it is duplicated. I believe it is something internal.
<?php
?>
<html>
<head>
<script type='text/javascript' src='
https://www.gstatic.com/charts/loader.js'></script>
<script type='text/javascript'>
google.charts.load('current', {
'packages': ['geochart'],
// Note: Because markers require geocoding, you'll need a mapsApiKey.
// See: https://developers.google.com/chart/interactive/docs/basic_load_libs#load-settings
'mapsApiKey': 'AIzaSyCsuCoCj9K2SZ0D7rM1Fqj0Xm73mwiodfQ'
});
google.charts.setOnLoadCallback(drawMarkersMap);
function drawMarkersMap() {
var data = google.visualization.arrayToDataTable([ <?php
$cities = "citiesa.txt";
$file = fopen('citiesa.txt', "r");
$data = file($cities);
$name = $data[count($data)-1];
echo "['City'],\n";
while(!feof($file)) {
$city = fgets($file);
$city1 = preg_replace("/\r\n|\r|\n/", '', $city);
if (strpos($country, $name) !== false) {
echo "['$city']; \n";
}else{
echo "['$city1'],\n";
}
}
?>
]);
var options = {
//colorAxis: {colors: ['red','red']}
displayMode: 'markers',
defaultColor: 'red'
}; var chart = new google.visualization.GeoChart(document.getElementById('chart_div'));
chart.draw(data, options);
};
</script>
</head>
<body>
<?php require "header2.php";?>
<div id="chart_div" style="width: 900px; height: 500px;"></div>
<?php require "footer.php";?> </body>
</html>