I am having problems posting this multi checkbox data with ajax.
<?php
foreach($_SESSION['contacts'] as $user => $id) {?>
<li class="contactList"><span><input type="checkbox" name="contact[]" id="contact" value="<?php echo $id; ?>" /></span><?php echo $user; ?></li>
<?php } ?>
then the ajax
var contact = $("#contact").val()
var days = $("#days").val()
$.ajax({
type: 'post',
url: 'temp_history.php',
data: {contact: contact, days: days},
context: document.body,
It is not posting the array of contacts as the form would submit normally but is submitting a single contact.
Any ideas?
You need you get values with loop. Try this: