PHP에서 메일 기능을 사용하려고합니다. 한 페이지에 다음 양식이 있습니다 :PHP 메일 기능 및 조건이있는 경우
<form action="sending.php" method="POST">
subject of the e-mail: <input type="text" name="subject" size="40" /><br>
recipient's e-mail: <input type="text" name="to" size="40" />
<input type="submit" name="send" value="send" />
</form>
이 페이지는 다른 페이지를 가리 킵니다. if 조건이 작동하지 않습니다. 양식의 필드를 비워 두더라도 출력 결과에 긍정적 인 메시지가 나타납니다.
<?php
if(isset($_POST["to"], $_POST["subject"]))
{
$to=$_POST["to"];
$subject=$_POST["subject"];;
$message='hello';
mail($to, $subject, $message);
echo "The data have been sent to the e-mail address you typed in.";
}
else
{
echo "I think you forgot to type in an e-mail address and/or a subject.";
}
?>
해결 방법을 제안 할 수 있습니까? 감사!
설정 여부가 아닌 '=='으로 설정되어 있지 않은지 테스트해야합니다. – Barmar