문제가 있습니다. 내 앱이 저장된 데이터를 기반으로 라디오 버튼을 확인하지 않는 것 같습니다. 실제로 두 개의 라디오 버튼이 있습니다. 값의 저장은 작동하지만 사용자가 계정을 사용하여 앱을 다시 방문하면 아무 라디오 버튼도 선택되지 않습니다.db 테이블의 데이터를 기반으로 라디오 버튼을 선택하거나 선택하는 방법은 무엇입니까?
여기에 값의 저장이 작동하지만 1 또는 2 값이 있습니다. 하여 DB 테이블 여기
//User.php
public function getGalleryMenuStyle($id = ''){
$gallerymenustyle = "SELECT gallery_menu_style FROM users WHERE user_id = ".$id;
$this->dbSelectQuery = $gallerymenustyle;
$checkedgallerymenustyle = $this->userDBSelect();
if($checkedgallerymenustyle){
return $checkedgallerymenustyle;
} else {
return false;
}
}
에서 라디오 버튼의 데이터를 당겨의 코드는 어떻게이 문제를 해결하는 프런트 엔드
$userCats = new User();
$user_id = $_SESSION['userData']['user_id'];
$checkedgallerymenustyle = $userCats->getGalleryMenuStyle($user_id);
<div align="center" class="radio_group">
<input type="radio" id="gallerymenustyle1" class="element radio" name="gallerymenustyle[]" value="1" <?php if($checkedgallerymenustyle == 1){ echo "selected"; }?> /> Gallery Link - In the navigation of my website, display one "gallery" link<br />
<input type="radio" id="gallerymenustyle2" class="element radio" name="gallerymenustyle[]" value="2" <?php if($checkedgallerymenustyle == 2){ echo "selected"; }?> /> Category Links - In the navigation of my website, display a separate link to each category.
</div>
의 코드인가? 내 코드에 문제가 있습니까?
당신의 프런트 엔드에 $의 checkedgallerymenustyle''에서 반향 시도해 봤어 적절한 가치를 얻고 있는지보십시오. –
그것은 배열이었습니다 : ( – sasori
ok, 대신에 echo를 사용하는 대신'print_r ($ checkedgallerymenustyle);'시도해보십시오. 배열에있는 것을 보여줄 것입니다, 그리고 여러분이 필요로하는 가치가 있는지를 알 수 있습니다 .. –