I'm trying to get autocomplete option for input form in phpdesktop-chrome which takes data from database and represents near input area while user input. The database I'm using is sqlite3 database.
HTML
<form action="actionpage.php" method="POST" class="register-form" id="register-form" autocomplete="on" >
<label for="itemname"> Item Name</label>
<input type="text" name="itemname" id="itemname" required placeholder="Enter item name">
<input action="insertpage.php" type="submit" name="submit" value="Submit">
</form>
JS
<script>
var items = [ <?php
$result=$db->query("SELECT * FROM register WHERE itemname='$itemname'");
while($row=$result->fetchArray(SQLITE3_ASSOC)) {
$item=$row['itemname'];
} ?>
];
autocomplete(document.getElementById("itemname"), items);
</script>