Follow along with the video below to see how to install our site as a web app on your home screen.
Бележка: This feature may not be available in some browsers.
<html>
<script type="text/javascript" src="jquery-1.8.js"></script>
<script type='text/javascript' src='jquery.autocomplete.js'></script>
<link rel="stylesheet" type="text/css" href="jquery.autocomplete.css" />
<head>
<script type="text/javascript">
$().ready(function() {
$("#course").autocomplete("get_course_list.php", {
width: 260,
matchContains: true,
//mustMatch: true,
//minChars: 0,
//multiple: true,
//highlight: false,
//multipleSeparator: ",",
selectFirst: false
});
});
</script>
</head>
<body>
<script type="text/javascript">
function showUser(str)
{
if (str=="")
{
document.getElementById("txtHint").innerHTML="";
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","getuser.php?q="+str,true);
xmlhttp.send();
}
</script>
<form>
<input type="text" name="course" id="course" onFocus="showUser(this.value)" onKeyUp="showUser(this.value)"/>
<div id="txtHint"></div>
</form>
</body>
</html>
[php]
<?php
$q=$_GET["q"];
$con = mysql_connect('localhost', 'root', '');
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("milanelo", $con);
$sql="SELECT * FROM klienti WHERE Surname = '".$q."'";
$result = mysql_query($sql);
while($row = mysql_fetch_assoc($result))
{
echo "<input name = 'id' value=". $row['Id'] .">";
echo "<input name = 'Firstname' value=". $row['Firstname'] . ">";
echo "<input name = 'Surname' value=". $row['Surname'] . ">";
}
mysql_close($con);
?>[/php]