1
Create several checkbox
with the same name can be considered wrong?
Since the value
is what defines the dado
of checkbox
.
Or should I really have names
different?
<tr>
<td>Status</td>
<td colspan="3">
<input type="checkbox" name="chk_stat[]" value="single" id="chk_stat">single
<input type="checkbox" name="chk_stat[]" value="married" id="chk_stat">Married
<input type="checkbox" name="chk_stat[]" value="divorcee" id="chk_stat">Divorcee
<input type="checkbox" name="chk_stat[]" value="student" id="chk_stat">Student
</td>
</tr>
Wrong is to put the same id on all elements.
– Sam
This way no, what is wrong is the repetition of Ids, Ids should be unique (Why it is considered wrong/bad to repeat an HTML ID?). The form of the Names is OK, they will be treated with a vector when received in the back-end.
– Guilherme Nascimento
Assuming the name was only name="chk_stat" would no longer be correct?
– Matheus Ribeiro
Then will always return the last marked. It would be incorrect to checkbox.
– Sam