+ 1

input tag

<input type="checkbox" name="gender" value="1" /> Male <br /> <input type="checkbox" name="gender" value="2" /> Female <br /> in this example ,why the name of 2 input are equal?

10th Aug 2017, 4:11 PM
fateme
5 Respostas
+ 4
Planet
22nd Sep 2021, 9:46 PM
Pallav jha
Pallav jha - avatar
+ 1
Whoever wrote this example is trying to submit the selected checkboxes into PHP, So the script will know which boxes have been selected by the user and act accordingly.. Use echo @$_POST['gender'] it will echo either number 1 or 2, considering the selected box. Cheers! :)
10th Aug 2017, 4:59 PM
Mohamed Hussien
0
Because you wrote it so? For what you're trying to do it's better to use a select (those drop down fields)
10th Aug 2017, 4:19 PM
voidneo
0
Planet
23rd Sep 2022, 7:30 AM
Deepa Joshi
- 2
false question
10th Aug 2017, 5:34 PM
KRITESH OJHA
KRITESH OJHA - avatar