> One of our customers has written a php application that we are hosting. > > Basically, there is a province/state table which populates a combo box. > When the form containing this combo box is submitted, the information is > added into the database. > > The problem is that when nothing is selected from the combo box, it adds a > number which seems to be random in the database, rather than the > province/state ID which it references from the province table. Obviously > there are many methods of avoiding this such as javascript to make sure > something is selected, or even giving the combo box a default value, but I > was wondering if anyone knew why the database itself isn't catching the > error (foreign key violation) and accepting the data. > > Any ideas? Are you using InnoDb tables? Otherwise there are no foreign key restrictions. How about some validation to make sure something is selected? Or, some validation that'll give the value a default if nothing is selected. Validate everything from the user! ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php