0
참고 : http://communitychessclub.com/rabren/index.php?clear=1의 왼쪽 체스 조각을 클릭하면 $ choice가 설정 해제되고 페이지가 다시로드됩니다. 그러나 그것은 단지 페이지를 다시 불러옵니다.javascript에서 PHP 5 변수가 설정 해제되지 않았습니다.
javascript에 설정된 변수 상태를 확인하고 싶습니다.
if ($_GET['clear']=="1") {empty($_SESSION['choice_1']);}
하고 배열을 재건하고 새로운 이미지 참조를 생성합니다
onclick="window.location='index.php?clear=1'
및 if clear == "1"
내가 가진 $choice_1
를 재설정합니다.
하지만 내가 가지고있는 것은 작동하지 않습니다. 그것은 결코 다시 설정하거나
$choice_1
내가 홈 페이지로 연결되는 링크가 포함 된 이미지가 비워 :
<img onclick="window.location='index.php?clear=1'; return false;"
src="images/WL<?php echo $_SESSION['choice_1'];?>.png" alt="pieces" width=128 height=128>
나는 index.php를 상단에 있습니다
이미지 세트 :
<?php
if ($_GET['clear']=="1") {empty($_SESSION['choice_1']);}
if(!isset($_SESSION['choice_1'])) {
$chessmen = array("N","Q","R","B","K","P");
$random_piece = array_rand($chessmen);
$_SESSION['choice_1'] = $chessmen[$random_piece];
unset($chessmen[$random_piece]);
$random_piece = array_rand($chessmen);
$_SESSION['choice_2'] = $chessmen[$random_piece];
}
?>
정말 고마워요! – verlager