Question: I have created a html file and a php file. What is the best way to combine the files and to make them to work

I have created a html file and a php file. What is the best way to combine the files and to make them to work the way they should. What code should I keep or even add to make it work the way it should?

For my assignment I need to create a page that contains an array of at least 20 movie titles or book titles (your choice). The page should have an input box for the user to enter the title and, as the user continues typing, the page should display all possible matches (i.e., hints). Use the Carla's Classroom project from the Putting It to Work section as a guide. Save your page with the file name title_hints.php and be sure to include any necessary accompanying files.

php page

// array of movie titles $a[]="Courageous"; $a[]="Finding Dory"; $a[]="Fireproof"; $a[]="Footloose"; $a[]="Frozen"; $a[]="God's Not Dead"; $a[]="I Can Only Imagine"; $a[]="I Still Believe"; $a[]="Jumanji"; $a[]="Love Comes Softly"; $a[]="Moana"; $a[]="Overcomer"; $a[]="Priceless"; $a[]="Santa Claus"; $a[]="Santa Paws"; $a[]="The Polar Express"; $a[]="The Parent Trap"; $a[]="The War with Grandpa"; $a[]="War Room"; $a[]="We Bought a Zoo";

//get the q value $q = $_GET["q"];

//searching all hints from the array if length q>0 if (strlen($q) > 0 { $hint=""; for($i = 0; $i < count($a); $i++) { if (strtolower($q) == strtolower(substr($a[$i],0, strlen($q)))) { if ($hint == "") { $hint = $a[$i]; } else { $hint = $hint." ; ".$a[$i]; } } } } // set output to "no suggestions" if the movie title has not been found // or set to the correct value when the movie title has been found if ($hint == "") { $response = "no movie title match"; } else { $response = $hint; //output the response echo $response; ?>

html page

Movie Name Search

Ex: Courageous, Footloose, Jumanji