I have an array of checkbox that is populated with data from mysql database through a query. I can submit the value of the checked checkbox into a table from a database. But I want it to be saved according to the sequence the checkbox was checked by the user. How can I achieve this? Any help will be appreciated. Thanks a lot!
Recommended Answers
Jump to PostTry this:
<?php if($_POST){ if(isset($_POST['hiddenarray'])){ $array = json_decode($_POST['hiddenarray']); print_r($array); } } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> <form name="myform" id="myform" method="post"> <input type="checkbox" id="firstcheck" class="mycheck" /> <input type="checkbox" id="secondcheck" class="mycheck" /> <input type="checkbox" id="thirdcheck" class="mycheck" /> <input type="checkbox" id="fourthcheck" class="mycheck" /> <input type="hidden" id="hiddenarray" name="hiddenarray" /> <input …