Hi,
I try to use the plugin "inputToken" but I cannot display the result list returned by the concerned research.
You can find the HTML code below :
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8" />
<meta name="description" content="website">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Website</title>
</head>
<body>
<form action="#" method="post" role="form">
<div>
<label for="collaborators">Collaborateurs</label>
<input type="text" name="collaborators" id="collaborators" size="80" maxlength="80" />
<br />
<input type="button" name="btnSubmit" value="Soumettre" />
</div>
</form>
<script>
$(document).ready(function(){
$("#collaborators").tokenInput("collaborators.php");
});
</script>
</body>
</html>
You can also find the PHP code :
$keysearch = $_GET['q'] . '%';
$sql_search_user = $db->prepare("SELECT USER_NAME FROM USER WHERE USER_NAME LIKE ?");
$sql_search_user->execute(array($keysearch));
$usersData = array();
$count_user = $sql_search_user->rowCount();
if ($count_user > 0)
{
while ($user_infos = $sql_search_user->fetch(PDO::FETCH_ASSOC))
{
$usersData[] = $user_infos;
}
}
echo json_encode($usersData);
You can find the content of the $userData array below :
[{"USER_FIRSTNAME":"Bouraada"},{"USER_FIRSTNAME":"Boussouf"}]
Unfortunately I don't know why that doesn't display the returned results.
Have you an idea ?
Thanks for your help.
Kind regards,
Thierry