<?php
function add_where_create($http_arg) {
	$add_where = "";
	for ($ix=1; $ix<=5; $ix++) {
		if ($_GET['chk'.$ix] <> '') {
			if ($_GET['chk'.$ix] == 'all') {
				 $_SESSION['abook_chk_sel'.$ix] = '';
			} else {
				 $_SESSION['abook_chk_sel'.$ix] = $_GET['chk'.$ix];
			}
		}
		if ($_SESSION['abook_chk_sel'.$ix] <> '') {
			if ($add_where <> "") $add_where .= " and ";
			$add_where .= " c_check".$ix." = '".$_SESSION['abook_chk_sel'.$ix]."'";
		}
	}
	return ($add_where);
}
?>
<?php
function add_my_filter($http_arg) {
?>
	<div id="check_select">
<script language="JavaScript">
function SelectionCheck(form, sel, no) {
	for (i = 0; i < sel.options.length; i++) {
		if (sel.options[i].selected == true) {
			window.location.href = '<?= $_SERVER['SCRIPT_NAME'] ?>?<?= query_from_http_arg_pool($http_arg) ?>&chk' + no + '=' + sel.options[i].value;
		}
	}
}
function SelectionCheckClear() {
		window.location.href = '<?= $_SERVER['SCRIPT_NAME'] ?>?<?= query_from_http_arg_pool($http_arg) ?>&chk1=all&chk2=all&chk3=all&chk4=all&chk5=all';
}
</script>
チェック有無：
<?php
	for ($ix=1; $ix<=5; $ix++) {
?>
	<?= roman_number($ix) ?>：<select name="" onchange="SelectionCheck(this.form, this, <?= $ix ?>)"<? if ($_SESSION['abook_chk_sel'.$ix] <> '') echo ' class="mp_list_filter_true"'; ?>>
	<option value="all" class="mp_list_filter_false">
	<option value="1"<?= $_SESSION['abook_chk_sel'.$ix] == '1' ? ' selected class="mp_list_filter_true"' : ' class="mp_list_filter_false"' ?>>有
	<option value="0"<?= $_SESSION['abook_chk_sel'.$ix] == '0' ? ' selected class="mp_list_filter_true"' : ' class="mp_list_filter_false"' ?>>無
	</select>
<?php
	}
?>
	<input type="button" value="リセット" onClick="SelectionCheckClear()">
	</div>
<?php
}
?>
