How do I get the result in the image? Here is my code for a weather forecast in php: Here is my code: Forecast Weather using PHP $data['list'][0]['weather'][0]['description'], 'icon' => $data['list'][0]['weather'][0]['icon'], 'maxtemp' => $data['list'][0]['temp']['max'], 'mintemp' => $data['list'][0]['temp']['min'], 'humidity' => $data['list'][0]['humidity'], 'speed' => $data['list'][0]['speed'] ); return $weather; } if (isset($_POST['city'])) { $city = $_POST['city']; $forecast = getForecast($city); if ($forecast) { echo ' ' . $city . ' Weather Forecast ' . date("l g:i a", $currentTime) . ' ' . date("jS F, Y", $currentTime) . ' ' . ucwords($forecast['description']) . ' High ' . $forecast['maxtemp'] . '°C Low ' . $forecast['mintemp'] . '°C Humidity: ' . $forecast['humidity'] . ' % Wind: ' . $forecast['speed'] . ' km/h '; } } else { echo ' City: '; } ?>

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter13: Handling Events
Section: Chapter Questions
Problem 4E
icon
Related questions
Question

How do I get the result in the image?

Here is my code for a weather forecast in php:

Here is my code:

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>Forecast Weather using PHP</title>

<style>

.report-container {

border: #E0E0E0 1px solid;

padding: 20px 40px 40px 40px;

border-radius: 2px;

margin: 0 auto;

color: #929292;

}

.weather-icon {

vertical-align: middle;

margin-right: 20px;

}

.weather-forecast {

color: #212121;

font-size: 1.2em;

font-weight: bold;

margin: 20px 0px;

}

span.min-temperature {

margin-left: 15px;

color: #929292;

}

.time {

line-height: 25px;

}

</style>

</head>

<body>

<div class="report-container">

<?php

function getForecast($city) {

$country = "US";

$url = "http://api.openweathermap.org/data/2.5/forecast/daily?q=" . $city . "," . $country . "&units=metric&cnt=1&lang=en&appid=c0c4a4b4047b97ebc5948ac9c48c0559";

$json = file_get_contents($url);

$data = json_decode($json, true);

$weather = array(

'description' => $data['list'][0]['weather'][0]['description'],

'icon' => $data['list'][0]['weather'][0]['icon'],

'maxtemp' => $data['list'][0]['temp']['max'],

'mintemp' => $data['list'][0]['temp']['min'],

'humidity' => $data['list'][0]['humidity'],

'speed' => $data['list'][0]['speed']

);

return $weather;

}

if (isset($_POST['city'])) {

$city = $_POST['city'];

$forecast = getForecast($city);

if ($forecast) {

echo '

<h2>' . $city . ' Weather Forecast</h2>

<div class="time">

<div>' . date("l g:i a", $currentTime) . '</div>

<div>' . date("jS F, Y", $currentTime) . '</div>

<div>' . ucwords($forecast['description']) . '</div>

</div>

<div class="weather-forecast">

<img src="https://openweathermap.org/img/w/' . $forecast['icon'] . '.png" class="weather-icon" />

High ' . $forecast['maxtemp'] . '°C <span class="min-temperature">

Low ' . $forecast['mintemp'] . '°C</span>

</div>

<div class="time">

<div>Humidity: ' . $forecast['humidity'] . ' %</div>

<div>Wind: ' . $forecast['speed'] . ' km/h</div>

</div>';

}

} else {

echo '

<form method="POST" action="weatherforecast.php">

City: <input type="text" name="city"/><br/><br/>

<input type="submit" name="forecast" value="Get Forecast"/>

</form>

';

}

?>

</div>

</body>

</html>

 

Weather Forecast (AssicX Forecast Weather using PHIX Forecast Weather using PH X ▸ (558) Weather app API X
C
Getting Started How To Java help Layout Design Theory ... Illustrator Special Effe...
Kansas City Weather
Wednesday 5:39 pm
19th April, 2023
Overcast Clouds
High 25.43°C Low 16.77°C
Humidity: 76 %
Wind: 10.12 km/h
Type here to search
cweb.northcentralus.cloudapp.azure.com/~philip/assignment5/weatherforecast.php
1
İ
C Create a function callecx
Reading Assignment: ...
CBS All Access Confir...
69°F
FavTutor - Live Coding X
www.myworkday.com
ចង
+
<
Best ASMR Microphon...
(4)
D
ENG
I
↓
5:44 PM
4/19/2023
X
»
4
Transcribed Image Text:Weather Forecast (AssicX Forecast Weather using PHIX Forecast Weather using PH X ▸ (558) Weather app API X C Getting Started How To Java help Layout Design Theory ... Illustrator Special Effe... Kansas City Weather Wednesday 5:39 pm 19th April, 2023 Overcast Clouds High 25.43°C Low 16.77°C Humidity: 76 % Wind: 10.12 km/h Type here to search cweb.northcentralus.cloudapp.azure.com/~philip/assignment5/weatherforecast.php 1 İ C Create a function callecx Reading Assignment: ... CBS All Access Confir... 69°F FavTutor - Live Coding X www.myworkday.com ចង + < Best ASMR Microphon... (4) D ENG I ↓ 5:44 PM 4/19/2023 X » 4
Expert Solution
steps

Step by step

Solved in 7 steps with 5 images

Blurred answer
Knowledge Booster
JQuery and Javascript
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L