Phrank;11019863 wrote:In that Javascript function am I supposed to be able to query a mysql table to see if the initials are already there
(already been used)?
... javascript can't query MySQL.
Phrank;11019863 wrote:I can load the initials from all the salepersons from the salespersons table in a PhP array at the beginning of the form.
Can you ck against that list via Javascript?
... javascript can't use PHP variables
(they don't even exist by the time js executes - PHP is server-side, js is client-side. time to learn the basics!).
IF you print the values into a javascript array, then yes (but it's not necessarily the best approach).
Phrank;11019863 wrote:Do you just tell mysql that the initials are UNIQUE and work with error routines when a user types some initials that already exists?
you can, yes.
Phrank;11019863 wrote:How do you guys do it?
You can use javascript to make an ajax call to a php script that checks if the option already exists in the DB.
You should also implement this check when you process the form and insert the data (after all, you should never trust user input).