Documents Original Xerox
-------------------------------------------------
ABC <checkbox> <checkbox>
DEF <checkbox> <checkbox>
XYZ <checkbox> <checkbox>
I have a checkbox structure, as you see it above. But I am not sure, how am I suppose to implement it. I know the working of a normal checkbox, as it has only one checkbox. But in this case, for every document, there are 2 checkbox (original copy and xerox copy)
What I have in mind like, after the submit is clicked, I need to somehow get an array in a form like below
ABC -> [1][1]
DEF -> [0][1]
XYZ -> [1][0]
Where first []
is orginal, and second []
is xerox.
Where 1
denotes that it was checked, and 0
denotes unchecked.
I am not getting an idea how should I implement it. This is my code...(It may be horribly wrong, i agree.. but i still i made an attempt.. but couldn't figure it out.)
<table>
<tr>
<td>Aadhar</td>
<td><input type="checkbox" name="document[]" value="1"/></td>
</tr>
<tr>
<td>Pan Card</td>
<td><input type="checkbox" name="document[]" value="1"/></td>
</tr>
<tr>
<td>Address</td>
<td><input type="checkbox" name="document[]" value="1"/></td>
</tr>
<tr>
<td>Light Bill</td>
<td><input type="checkbox" name="document[]" value="1"/></td>
</tr>
<tr>
<td><input type="submit" value="Submit" /></td>
</tr>
</table>
PHP
$documents = $_POST['document'];
$a = implode($documents);
echo $a;
So far, I am getting 1
(value) correctly.. But I also need the document
(key) to which the '1
'(value) belongs.
Can anyone help me out please.