Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

create a page that has a place for a user to type. As the user is typing, a list

ID: 2247162 • Letter: C

Question

create a page that has a place for a user to type. As the user is typing, a list of restaurant names should be shown to the user. The results should include any restaurant whose name starts with the letters the user has typed so far and any restaurant whose cuisine starts with the letters typed so far. The page should be written in PHP and jQuery.

the data to read in will just be a text file in csv format RESTAURANT NAME, FOOD ITEM, so example from a text file:

Mcdonalds, chesseburger

Taco Bell, Beef softshell taco,

etc,.

Explanation / Answer

index.html

<html>
<head>
<title> Resturant AutoFilling </title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script>
$(function() {
$( "#resturant" ).autocomplete({
source: 'searching.php'
});
});
</script>
</head>
<body>
<div class="ui-widget">
<label for="resturant">Resturant: </label>
<input id="resturant">
</div>
</body>

searching.php

<?php
$host = 'localhost';
$uname = 'root';
$pswd = 'bisht';
$name = 'akshay';
  
$database = new mysqli($host,$uname,$pswd,$name);
  
$search = $_GET['term'];
  
$qu = $database->qu("SELECT * FROM resturant WHERE resturant LIKE '%".$search."%' ORDER BY resturant ASC");
while ($rows = $qu->fetch_assoc()) {
$dat[] = $rows['resturant'];
}
  
echo json_encode($dat);
?>

You will have to make an database with the row resturant and similar to any row you need to fill with the names. You will have to enter the data of the name of the resturants. You can put the names in any order no need of keeping them in order as in the query they will get in an ascending order.

Rate an upote.....Thankyou

Hope this helps.....