We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

checkbox problem.

designersx
designersx asked
on
Medium Priority
310 Views
Last Modified: 2012-05-07
i am using checkbox in my form. what datatype i should take in mysql database. like i have a checkbox named sex having options male and female like below.

1) what data type i should take in mysql database
2) how can i retrieve the value using $_REQUEST.

<tr>
<td>Sex</td>
<td colspan="2"><input type="checkbox" name="sex" id="sex" value="male" /></td>
<td align="right">Female</td>
<td colspan="2"><input type="checkbox" name="sex" id="sex" value="female" /></td>
</tr>

please help me.
Comment
Watch Question

CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
how about making the datatype in the DB a boolean.  Set the feild to female and if they answer male in the form set the boolean value in the DB to false?

Author

Commented:
gamebits: u r great thanks a lot
Vimal DMSenior Software Engineer
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
vimalmaria: and gamebits both have given the good solution but gamebits got the higher marks because i saw his comment and my problem was solved at that time.
CERTIFIED EXPERT

Commented:
Than you should have accepted my solution vimalmaria was almost 2 hours late.
Vimal DMSenior Software Engineer
CERTIFIED EXPERT

Commented:
ya gamebits i accept this

i have given with some explanation that's all

good.
CERTIFIED EXPERT

Commented:
No offense vimalmaria I guess I just had a bad day, take care.
Vimal DMSenior Software Engineer
CERTIFIED EXPERT

Commented:
Hi,

Ok no issue on this,

sorry for the mistake.

See U

take care
Vimal DMSenior Software Engineer
CERTIFIED EXPERT

Commented:
Hi,

sorry once again
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.