如果在点击按钮后选中复选框,我该如何检查php?
我试着这样做,但没有任何反应。它返回了我第一个条件的答案。我试着把#34;检查"其中一个复选框上的属性,但代码仍然无效...
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready(function() {
$('#refreshList').on('click', function() {
var url = 'admin/thisPage.php';
$('#div1-wrapper').load(url + ' #div1');
});
});
</script>
</head>
<body>
<div>
<input type="checkbox" name="active_registration" id="active_registration" value="" > active registration
<input type="checkbox" name="coming_events" id="coming_events" value="" /> Comming events
<button type="button" class="btn btn-primary" id=refreshList>refresh</button>
</div>
<div id="div1-wrapper">
<div id="div1">
<?php
if ( !isset($_POST["active_registration"]) && !isset($_POST["coming_events"])) {
echo "false/false";
}
if ( isset($_POST["active_registration"]) && !isset($_POST["coming_events"])) {
echo "true/false";
}
if ( !isset($_POST["active_registration"]) && isset($_POST["coming_events"])) {
echo "false/true";
}
if ( isset($_POST['active_registration']) && isset($_POST['coming_events'])) {
echo "true/true"
}
?>
</div>
</div>
</body>
</html>