How to store value of radio button?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to store value of radio button??

we developed the attendancr system but the value of the radio buttton for the absent and present is not store in data base.how can i store value of radio button and i took the value of the radio button id boolean function 0 and 1.

23rd Nov 2016, 9:24 AM
THE MONSTER
THE MONSTER - avatar
1 Answer
+ 3
Do not use Boolean, if there is more than 2 ratio choice. You will be in trouble. Like Gender: <input type="radio" name="gender" <?php if (isset($gender) && $gender=="female") echo "checked";?> value="female">Female <input type="radio" name="gender" <?php if (isset($gender) && $gender=="male") echo "checked";?> value="male">Male You can get $gender by $gender=$_POST["name"]; You can store it as INSERT INTO table_name (gender) VALUES ('$gender');
23rd Nov 2016, 11:54 AM
Aditya kumar pandey
Aditya kumar pandey - avatar