Dodge
-
Posts
1 -
Joined
-
Last visited
Never
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.
Quite a few Booleans…
in MySQL Help
Posted
I’m designing a registration form for my website in which I want users to be able to select from a list of US states which they are available to work in. This could be more than one. Whenever I have encountered this before I have simply used checkboxes and recorded, along with the user_id, which items the user selected as Booleans in a `states` equivalent table. Obviously it wouldn’t be appropriate, nor I imagine efficient to check for each boolean per State.
Is there another way I could do this?
One last thing… what is the best way to handle “required” fields? At the moment I have been doing something like:
//Check if user has entered an email
if(!$_POST['email']) {
die('Error: Email field was blank');
}
for each field. Is there a way to combine all the checks in every field, and still have the error report the exact field that was left empty?
Thanks for all your help,