chelnov63 Posted April 21, 2009 Share Posted April 21, 2009 hi an excerpt from my form is something like this: <input name="send[]" type="checkbox" id="send[]" value="10"; /> <input name="send[]" type="checkbox" id="send[]" value="12"; /> <input name="send[]" type="checkbox" id="send[]" value="16"; /> <input name="send[]" type="checkbox" id="send[]" value="17"; /> <input name="send[]" type="checkbox" id="send[]" value="14"; /> excerpt from the php file is: $send = $_POST["send"]; $sendIndexes= array(); $i = 0; foreach ($send as $key) { $sendIndexes[$i] = "$key"; $i++; } The above puts the checked checkbox values into an array. However I want to do the opposite i.e put the unchecked checkboxes values into an array. Is this possible..thanks in advance.. Link to comment https://forums.phpfreaks.com/topic/155048-php-retrieving-checkboxes-values/ Share on other sites More sharing options...
rhodesa Posted April 21, 2009 Share Posted April 21, 2009 you need to know the list if you want to do that. the form only passes the checked checkboxes. something like this should work though: $list = array(10,12,16,17,14); $unchecked = array_diff($list,$_POST['send']); Link to comment https://forums.phpfreaks.com/topic/155048-php-retrieving-checkboxes-values/#findComment-815488 Share on other sites More sharing options...
chelnov63 Posted April 21, 2009 Author Share Posted April 21, 2009 aaah great..thanks for that mate!! cheers Link to comment https://forums.phpfreaks.com/topic/155048-php-retrieving-checkboxes-values/#findComment-815490 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.