So im working on an app that uses a weather api. In the video course that im using the guy in that course has the exact same code as me but his works and mines doesnt. Im using xampp to test out my php code.
<?php
$weather = "";
$error = "";
if ($_GET['city']) {
$urlContents =
file_get_contents("http://api.openweathermap.org/data/2.5/weather?q=".$_GET['city'].",uk&appid=");
$weatherArray = json_decode($urlContents, true);
print_r($weatherArray);
}
?>
The error message is
Notice: Undefined index: city in C:\xampp\htdocs\mobileapp\weather.php on line 6
line 6 is
if ($_GET['city']) {
Also I'm sorry if this has a simple answer im just new to php.