
Originally Posted by
r937
yes, that's how you construct the dropdown menu
but when the form is submitted, the field value is automatically checked for correctness (i.e. you don't use a separate lookup query) by the foreign key in the users table
I'm getting more confused here...
I create my User table with these fields...
Code:
- id
- name
- gender
- eye_color
And then I create a Lookup Table with this one field...
In my web-form I have some form control that offers "Male" and "Female" as choices.
When the form is submitted, I do an INSERT like this...
Code:
$q3 = "INSERT INTO user(id, name, gender, eye_color)
VALUES(?, ?, ?, ?, ?)";
How is my Look-Up Table enforcing anything?
Do I need to add some constraints?
And *if* the database is enforcing that "gender" must be either "Male" or "Female" then what happens if that isn't the case?
Now that I think about it, I've actually always relied on my Front-End to do the data validation and ensure that the right data goes into the right fields?
Sounds like you are talking about something different...
Debbie
Bookmarks