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!
xjshiya
8
Light Poster
Recommended Answers
Jump to PostWhat happens if the user unchecks the box does that change the sequence?
This might be tricky. And the only way I can see doing this is to use some client side javascript processing.
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" …
All 8 Replies
iamthwee
xjshiya
8
Light Poster
diafol
iamthwee
commented:
Nice!
+14
xjshiya
8
Light Poster
diafol
iamthwee
xjshiya
8
Light Poster
meharsaracomp
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.