당신은 break;
가 불필요 $wkday
, 데이브 고텐 말했다 플러스로
$wkday = date('D');
을 참조에 elseif ($wkday == "Sat")
같이해야하는 elseif ($currday == "Sat")
에 잘못된 변수 $currday
를 참조한다.
는 exit;
, die;
또는 return;
필요한 경우 추가합니다. error reporting 그 주어진 일에 정의되지 않은 변수 을 신호 것 같은
는 $wkday = date('D');
if ($wkday == "Sun") {
$noaccess = "yes";
} elseif ($wkday == "Sat") {
$noaccess = "yes";
} else {
$noaccess = "no";
}
// test echo
if ($noaccess == "yes") {
echo "You cannot access this area now";
} else {
//Form displays normally
echo $noaccess; // test variable echo
echo "You have access";
}
기본 디버깅.
즉 :
Notice: Undefined variable: currday...
오류를 찾는 데 도움이됩니다 파일 (들)의 상단에 error reporting를 추가합니다.
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
// rest of your code
(!) 참고 : 오류보고는 생산을 결코 준비에서 수행하지 않으며,해야합니다. 당신이 포함되지 않았기 때문에 ...
//Form displays normally
echo "<form action='' method='post'>"; // or get. I have no idea what you're using
echo "<input type='text' name='name'>";
echo "<input type='submit' name='submit'>";
echo "</form>";
를 귀하의 질문에 그 :
플러스,이 양식은 다음과 유사해야합니다. 구문 오류가 없는지 확인하십시오.
* "코드를 실행하면 양식이로드되지 않습니다."* - 양식과 사용 방법을 보여줍니다. –
'$ currday'는 정의되어 있지 않고'break;'는 불필요합니다. –