I have a form on my site that has a vendor name and address section and next to it a 'ship to' name and address section. I have used an ajax script before that will search through a database as I type and will display a drop down below the form field of the first 5 names that match that name from the database, and if you select one it fills the form with the name or ID number for that name. (sort of like [url removed, login to view] does) but what I need to do is this: Each name and address section (both the vendor and ship to sections) have 6 fields (name, address, city/state/zip, phone, fax, contact) that are stored in their own databases (their is a vendor database and a 'ship to' database) the vendor database has a column for 'ship to links' where all previously 'ship to' entries are stored in the 'ship to database' and the ids for each of those are listed on the column 'ship_to_links' and separated by a delimiter ( | ). What I need is an ajax script that will first while the user is typing in the vendor name it is auto searching the vendor database and displays the first 5 entries, then is the user clicks one it auto-fills the rest of that form fields (for the vendor database) AND it selects the first ship_to id in the list of ship_tos and fills in the second form field with the data from the 'ship to' database for that first entry. If there are multiple 'ship to links' in the 'ship to links' column in the vendor database it will split them up by delimiter and it will display a drop down field on the 'name' section of the 'ship to' form where it will list all the 'ship to' locations that are linked to in the vendors 'ship to links' column, they can select any of those ship to location by dropping down and selecting the name of the ship to location from the drop down menu on the name section of the ship to form, and will allow them if they like to type in a new ship to location if there is a new location they want to enter.
I attached my form, it is a php form but I saved it as .html to upload so you can view it locally. I also attached an ajax script that will pull up and fill out a form based on an id being entered, you can modify that so that it works with the ajax autocomplete mysql lookup, which I added a link to in a text file. You can modify these to work together which should be pretty simple. The autocomplete can lookup the name associated with the entry via autosuggestion, when the user selects that it will then use the ajax script that fills in the form based on the id selection (using the name name as the id), and then somehow make the script you make read the ship_to_links in the vendor database to fill in the data on the ship_to_form (with the multiple options if there are multiple ship_to locations.
Mind you, you don't have to use those files I suggested, they are just suggestions to make it easier, if you have a better idea then we can go that way.