I have a form with a bunch of <select> fields - most of these have only about 4 <options>. I am first writing the PHP validation and this checks if the user has selected an <option> then it adds the attribute of “selected” to that option. However there are a lot of if statements (the way I am doing it). I have a state field with 50 of the US states and I am wary about adding 50 unnecessary if statements. Guidance is appreciated.
First off, writing all those statements for each state would be a pain, second I am not sure about all those if statements. How would a pro handle this? Teach me!
siteguru - thanks for that. I think this is a good lesson in arrays in general. I appreciate you doing that. Ill have to give it a shot when I get home.