I am trying to simplify data entry for a web form. I found a good autocomplete script that I really like and have been using for a while. This is the first time that I am using an autocomplete form to add an entry into a database that has referential integrity between two tables. (Normally I just send and email or do a direct data dump into a database table).

What I would like is to have a form that display to the user the first/last name of the customer and in the background a hidden input or the tag value gets updated with the associated database ID for that customer.

Here is the data.php code.

PHP Code:
        $sRequest "SELECT `ID`,`NAME` FROM `customers` WHERE `NAME` LIKE '%{$sParam}%'";
$aItemInfo $GLOBALS['MySQL']->getAll($sRequest);
        foreach (
$aItemInfo as $aValues) {
$aValues['NAME'] . "\n";
    $('.name').autocomplete('data.php?mode=sql', {
        width: 200,
        max: 5
The Autocomplete JS file is very hard to read...The source code came from here.

If someone can provide a link to an article that discusses how to return the ID in a hidden field, I can do the reading and code translation. Just need some assist on what would be a good method.