1
希望有人可以帮我用我的代码。我正在使用重写的URL并在窗体上放置了这段代码。当页面第一次加载mypage.htm时,默认情况下,type_24复选框被选中。如果他们检查type_12框,我想type_24框取消选中。PHP复选框和URL重写
我的问题是,如果我检查type_12框,页面刷新和type_12和type_24框被检查..这不是我想要的。我认为这是因为我在我的操作中重新加载了我的重写URL,因为它工作正常,如果我只是将php文件作为操作。
任何想法如何我可以修复我的代码,以便它只有检查type_24时检查type_12?
<form name="frmrefresh" id="frmrefresh" method="post" action="mypage.htm">
<input type="checkbox" name="type_12" id="type_12" <?php if(isset($_POST['type_12']) && $_POST['type_12']=="12"){?> checked="checked"<?php }?> value="12" onClick="uncheck24(this);" /> <label>12</label>
<input type="checkbox" name="type_24" id="type_24" <?php if(isset($_GET['id']) && $_GET['id']!=''){?>checked="checked"<?php }?><?php if(isset($_POST['month_24']) && $_POST['type_24']=="24"){?> checked="checked"<?php }?> value="24" onClick="uncheck12(this);"/> <label>24 Months</label>
<input type="hidden" name="id" value="<?php echo $_REQUEST['id'];?>" />
</form>
在标题中,我有以下功能:
function uncheck12(obj)
{
if (obj.checked == true)
{
document.getElementById("type_12").checked = false;
document.frmrefresh.submit();
}
}
function uncheck24(obj)
{
if (obj.checked == true)
{
document.getElementById("type_24").checked = false;
document.frmrefresh.submit();
}
}
约翰你好,非常感谢你的帮助。但一个问题,当页面刷新,和我做这种检查\t \t \t \t 如果(isset($ _ REQUEST [ 'type_24'])&& $ _REQUEST [ 'type_24'] == '24'),它仍然认为type_24仍然检查,即使在屏幕上它看起来没有选中?任何想法为什么?谢谢! – gatin 2012-02-26 14:02:01
你能否澄清你的意思是'它仍然认为type_24仍然被检查'?你在哪里以及如何看到这个? – John 2012-02-26 19:40:06