我设计了2个html页面,在这里我找到了2页的复选框相同的代码。我想要这个,当我选择第一页的复选框,然后在第2页自动选择相同的复选框。我可以做这个吗?
我在2页的chk框代码
您是否希望其他人可以复制?
是的
否
答案 0 :(得分:1)
让这成为你的html表格。
<form action="your/action" method="POST" name="form">
<input type="checkbox" name="postCheckBox" value=""/>
<input type="submit" value="submit"/>
</form>
在/your/action.php页面
$_SESSION['postCheckBox'] = isset($_POST["postCheckBox"]) ? $_POST["postCheckBox"] : null;
在您的下一个html页面中:
<input type="checkbox" name="somename" <?php echo isset($_SESSION['postCheckBox']) && $_SESSION['postCheckBox'] == 1 ? 'checked="true": ""' ?>value=""/>
答案 1 :(得分:0)
我认为最简单的方法是在会话中添加一个值并在另一页上阅读。
答案 2 :(得分:0)
Checkbox will select automatically perticular checkboxes from selected price list of home page.
$("input[name=categories]").each( function (index) {
iterations = $.cookie('total_iterations');
var orgval = $(this).val();
for (var i = 1; i <= iterations; i++) {
var chkval =$.cookie("plan_item_cookie_cb_"+i);
if(chkval.trimRight() == orgval )
{
$(this).prop('checked', true);
}
};
});
$('#plan_section_id_1').click(function(){
var cookies = $.cookie();
for(var cookie in cookies) {
$.removeCookie(cookie);
}
var count=0;
//alert('outside');
$('#plan_section_id_1').find('input[type="hidden"]').each(function(){
//alert('in');
its = $('#plan_section_id_1 .total_iterations').val();
if ($(this).val().length) {
//if ($.trim($(this).val()).length) {
count++;
$.cookie('plan_item_cookie_cb_'+count,decodeURI($(this).val()),60);
//$.cookie('section-id','plan_section_id_1');
$.cookie('total_iterations',its);
}
});
});
$('#plan_section_id_2').click(function(){
var cookies = $.cookie();
for(var cookie in cookies) {
$.removeCookie(cookie);
}
var count=0;
$('#plan_section_id_2').find('input[type="hidden"]').each(function(){
its = $('#plan_section_id_2 .total_iterations').val();
if ($(this).val().length) {
//if ($.trim($(this).val()).length) {
count++;
$.cookie('plan_item_cookie_cb_'+count,decodeURI($(this).val()),60);
$.cookie('total_iterations',its);
}
});
});
$('#plan_section_id_3').click(function(){
var cookies = $.cookie();
for(var cookie in cookies) {
$.removeCookie(cookie);
}
var count=0;
$('#plan_section_id_3').find('input[type="hidden"]').each(function(){
its = $('#plan_section_id_3 .total_iterations').val();
if ($(this).val().length) {
//if ($.trim($(this).val()).length) {
count++;
$.cookie('plan_item_cookie_cb_'+count,decodeURI($(this).val()),60);
$.cookie('total_iterations',its);
}
});
});