Mysql & Php combo box

I have a user registration form, I’d like to have a combo box for the state

when the person selects the state and submits I need the selectinon of the combo box passed to the database so the user can be categorized by the state.

In MY DB — the users table



# 	Name 	Type 	Collation 	Attributes 	Null 	Default 	Comments 	Extra 	Action
	1 	idPrimary 	int(8) 			No 	None 		AUTO_INCREMENT 	Change Change 	Drop Drop 	

    More

	2 	name 	varchar(30) 	latin1_swedish_ci 		No 	None 			Change Change 	Drop Drop 	

    More

	3 	emailIndex 	varchar(60) 	latin1_swedish_ci 		No 	None 			Change Change 	Drop Drop 	

    More

	4 	password 	varchar(40) 	latin1_swedish_ci 		No 	None 	

So far I just have user e-mail and password.

How can I pass the value of the combobox selected to the database
and what column configuration should I set in my db for this?

<div class="form-group">
<label for="name">State</label>
<select>
        <option value="NY">NY</option>
         <option value="LA">LA</option>

For example if the user selects NY, NY is passed to the column state under the table users.

Table users is my user info table that the values are stored from there registration.

Also how should I create the new column

4 	state 	varchar(2) 	latin1_swedish_ci 		No 	None 	

something like that 2 chars for NY ?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.