when i type in a movie name in the search field i want to display all the movies that is the json file but with this code i can only get one of the movies can you please help me with this.
<?php
if (isset($_POST['submit-search'])) {
$txtresult = $_POST['search'];
function getImdbRecord($title, $ApiKey)
{
$path = "http://www.omdbapi.com/?s=$title&apikey=$ApiKey";
$json = file_get_contents($path);
return json_decode($json, TRUE);
}
$data = getImdbRecord($txtresult, "f3d054e8");
echo "<div class = 'info-box'><img src =".$data['Poster']."</img><h3> Name :".$data['Title']."</h3><h3> Year : ".$data['Year']."</h3><h3> Duration : ".$data['Runtime'],"</h3></div>";
}
?>