I guess you could select the codes into an array, use
in_array() on the array, and submit the data if the result is true, otherwise use javascript to send the alert.
example theory:
NOT real code, just example process
assume form has a $_POST array
// get codes from the database and load array
..
// check if the $_POST[whatever_code] is in the array
if(in_array($_POST[whatever], array)
insert into db
else
javascript alert ....
______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.