In my database I have a list of city and I want to use them for an autocompletion textfield, but it doesn't work and I don't know what is wrong ?
Here is my textfield in html:
<input name="signup_ville" id="signup_city" class="form-control" type="text" placeholder="Ville" required />
In the JS script I only add the source fot the php file with the request:
$('#signup_city').autocomplete({
source : './Application/Script/liste_ville.php'
});
And this is my php file.
<?php
include_once 'config.inc.php';
$term = $_GET['term'];
$termParse = '%'.$term.'%'
$requete = $PDO_BDD->query("SELECT * FROM ville WHERE nom LIKE '$termParse'");
$array = array(); // on créé le tableau
while($donnee = $requete->fetch())
{
array_push($array, $donnee['nom']);
echo "test";
}
echo json_encode($array);
?>
I don't even know if that file is called by the JS function because the echo "test"
doesn't display anything