这是我的代码
<table class='block'>
<tr>
<td>
<input class='c1' type='checkbox' lid='checkbox1'>
<label>checkbox1</label>
</td>
<td>
<input class='c2' type='checkbox' lid='checkbox2'>
<label>checkbox2</label>
</td>
<td>
<input class='c2' type='checkbox' lid='checkbox3'>
<label>checkbox3</label>
</td>
<td>
<input class='c2' type='checkbox' lid='checkbox4'>
<label>checkbox4</label>
</td>
<td>
<input class='c3' type='checkbox' lid='checkbox5'>
<label>checkbox5</label>
</td>
<td>
<input class='c3' type='checkbox' lid='checkbox6'>
<label>checkbox6</label>
</td>
</tr>
</table>
<script type='text/javascript'>
$('input[type=checkbox]').each(function (){
if (this.checked) {
var x = $(this).attr('lid');
}
});
</script>
<?php
if(!isset($_SESSION))
{
session_start();
}
if(!isset($_GET['x'])) $_GET['x'] = '';
$_SESSION['x'] = $_GET['x'];
?>
我想在会话中保存选定的复选框。这样,当我回到页面时,应该保持选中相同的复选框。