I have created a checkbox,what database table will I need to save in the numbers ? example of what I am thinking of, to create a table with a name mytable so I will have
id pos
1 13
2 14
if someone check the 14 to be like a then
id pos pawn
1 13
2 14 a
if someone check the 13 to be b then
id pos pawn
1 13 b
2 14 a
if someone check for example 13 to be a and b ,so I will have
id pos pawn
1 13 a b
2 14
I tried
CREATE TABLE `mytable` (
`id` numeric(24) DEFAULT NULL,
`position` numeric(24) DEFAULT NULL,
`last_action` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
)
the code of doing that is this on my index.php.Only two ticks allowed. 1 tick for a ,13 until 24 and 1 tick for b ,13 until 24.I didn't managed to do that.
<form action="index.php" method="post">
13<input type="checkbox" name="check_list[]" value="value 1"> a
<br>
14 <input type="checkbox" name="check_list[]" value="value 2">a
<br>
15 <input type="checkbox" name="check_list[]" value="value 3">a
<br>
16 <input type="checkbox" name="check_list[]" value="value 4">a
<br>
17 <input type="checkbox" name="check_list[]" value="value 5">a
<br>
18 <input type="checkbox" name="check_list[]" value="value 6">a
<br>
19 <input type="checkbox" name="check_list[]" value="value 7">a
<br>
20 <input type="checkbox" name="check_list[]" value="value 8">a
<br>
21 <input type="checkbox" name="check_list[]" value="value 9">a
<br>
22 <input type="checkbox" name="check_list[]" value="value 10">a
<br>
23 <input type="checkbox" name="check_list[]" value="value 11">a
<br>
24 <input type="checkbox" name="check_list[]" value="value 12">a
<br>
13<input type="checkbox" name="check_list[]" value="value 1"> b
<br>
14 <input type="checkbox" name="check_list[]" value="value 2">b
<br>
15 <input type="checkbox" name="check_list[]" value="value 3">b
<br>
16 <input type="checkbox" name="check_list[]" value="value 4">b
<br>
17 <input type="checkbox" name="check_list[]" value="value 5">b
<br>
18 <input type="checkbox" name="check_list[]" value="value 6">b
<br>
19 <input type="checkbox" name="check_list[]" value="value 7">b
<br>
20 <input type="checkbox" name="check_list[]" value="value 8">b
<br>
21 <input type="checkbox" name="check_list[]" value="value 9">b
<br>
22 <input type="checkbox" name="check_list[]" value="value 10">b
<br>
23 <input type="checkbox" name="check_list[]" value="value 11">b
<br>
24 <input type="checkbox" name="check_list[]" value="value 12">b
<br>
<button type="submit" onclick="transfertoanotherpage()" class='btn btn-primary'> End of turn</button>
</form>
<?php
if(!empty($_POST['check_list'])) {
foreach($_POST['check_list'] as $check) {
echo $check;
}
}
?>
</div>
Aucun commentaire:
Enregistrer un commentaire