我正在使用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