
Originally Posted by
seannie
They type the values into an input box.
Then how can you be sure the value exists in the respective tables?
If you want to give the user the possibility to add any value, then there's no need for foreign keys and other tables.
If you want them to choose one of the existing values from the type, dept or sect table, then just load those values in a select box, and put the foreign key in the value property of the option, like this:
Code:
<select name="type">
<option value="key1">value 1</option>
<option value="key2">value 2</option>
<option value="key3">value 3</option>
</select>
This way, in your script you'll already have the foreign key value.
Bookmarks