我正在使用jQuery向下滑动并基于无线电选择向上滑动<div>
。jQuery函数不知道选择哪个选项来移动
然后,我有一些PHP代码,记得设置了什么选项,所以如果用户浏览和从页面导航,它会记住,如果他们有“隐藏框”。
该代码昨天工作,但似乎今天没有工作。我试过调试但没有运气。
的jQuery:
$('.children-under-18-yes').click(function(){
$('.children-guardians').slideDown();
});
$('.children-under-18-no').click(function(){
$('.children-guardians').slideUp();
});
PHP/HTML
<h2>Are any of the children under 18 years old?</h2>
<li>
<label class="radio"><input type="radio" name="children_under_18" id="children_under_18" group="underage" class="children-under-18-yes" value="yes"<?php echo stickyRadio('children_under_18','yes');?> />Yes</label>
<label class="radio"><input type="radio" name="children_under_18" id="children_under_18" group="underage" class="children-under-18-no" value="no"<?php echo stickyRadio('children_under_18','no');?> />No</label>
</li>
<br class="clear" />
<div class="children-guardians"<?php echo isset($_SESSION['chidren_under_18']) && $_SESSION['chidren_under_18'] != 'no' ? 'style="display: block;"' : 'style="display: none;"' ?>>
<h3>As you answered yes, please provide the names of those persons you want to serve as guardians of your minor child(ren) in the event of your death. </h3>
<li>
<label class="float">1st Choice Guardian</label>
<input type="text" name="1st_guardian" id="1st_guardian" value="<?php echo stickyText('1st_guardian'); ?>" />
</li>
<li>
<label class="float">2nd Choice Guardian</label>
<input type="text" name="2nd_guardian" id="2nd_guardian" value="<?php echo stickyText('2nd_guardian'); ?>" />
</li>
</div>
会议发布(从页)
if(empty($missing)) {
post2session(array('children'));
$_SESSION['step'][2] = 2;
if(isset($url)) {
redirect($url);
}
}
会后功能
function post2session($parts = array()) {
$out = array();
foreach($_POST as $key => $value) {
$value = is_array($value) ? $value : trim($value);
$par = explode("#",$key);
if(in_array($par[0],$parts)) {
$out[$key] = $value;
} else {
$_SESSION[$key] = $value;
}
}
if(!empty($out)) {
foreach($_SESSION as $key => $value) {
$par = explode("#",$key);
if(in_array($par[0],$parts) && !array_key_exists($key,$out)) {
unset($_SESSION[$key]);
}
}
foreach($out as $key => $value) {
$_SESSION[$key] = $value;
}
} else {
foreach($_SESSION as $key => $value) {
$par = explode("#",$key);
if(in_array($par[0],$parts)) {
unset($_SESSION[$key]);
}
}
}
}
如何更新有关状态更改的会话数据? – Gumbo 2011-03-17 12:45:10
我有一个函数在php中称为Post to session我将使用会话代码 – Xavier 2011-03-17 12:46:04