<?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';
}
function CheckboxEmailOnOff(onOff) {
	if (onOff == 'off') {
		window.location.href = "<?= $_SERVER['SCRIPT_NAME'] ?>?<?= query_from_http_arg_pool($http_arg) ?>&em=on";
	} else {
		window.location.href = "<?= $_SERVER['SCRIPT_NAME'] ?>?<?= query_from_http_arg_pool($http_arg) ?>&em=off";
	}
}
</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()">
	<input type="checkbox" name="" value="on" onClick="CheckboxEmailOnOff('<?= $_SESSION['abook_email_off'] ?>')"<?= $_SESSION['abook_email_off'] == 'off' ? ' checked' : '' ?>>電話・EMail表示なし
	</div>
<?php
	$chk_use = array();
	$sqlchk = "select * from m_check_caption where id_account = " . $_SESSION['current_id'];
	$sqlchk .= " and ( c_caption1 <> '' or c_caption2 <> '' or c_caption3 <> '' or c_caption4 <> '' or c_caption5 <> '' )";
	$rs_chk = my_mysql_query($sqlchk);
	if (mysql_num_rows($rs_chk) <> 0) {
		$rec = mysql_fetch_array($rs_chk);
		if ($rec) {
			echo '<p id="check_caption_box">';
			for ($ix=1; $ix<=5; $ix++) {
				if ($rec['c_caption'.$ix] <> '') {
					$chk_use[$ix] = True;
					echo '<span class="check_caption"><b>'.roman_number($ix).'</b>：&nbsp;'.$rec['c_caption'.$ix].'</span>&nbsp;&nbsp;';
				} else{
					$chk_use[$ix] = False;
				}
			}
			echo '</p>';
		}
	}
}
?>
