<title>PHP Form Validation</title>
$nameMsg = $emailMsg = $genderMsg = $websiteMsg = $favtopicMsg = $commentMsg = "";
$name = $email = $gender = $website = $favtopic = $comment = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$gender = $_POST["gender"];
$email = $_POST["email"];
$website = $_POST["website"];
$favtopic = $_POST["favtopic"];
$comment = $_POST["comment"];
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>">
이름 : <input type="text" name="name">
<input type="radio" name="gender" value="female">여자
<input type="radio" name="gender" value="male">남자
이메일 : <input type="text" name="email">
홈페이지 : <input type="text" name="website">
<input type="checkbox" name="favtopic[]" value="movie"> 영화
<input type="checkbox" name="favtopic[]" value="music"> 음악
<input type="checkbox" name="favtopic[]" value="game"> 게임
<input type="checkbox" name="favtopic[]" value="coding"> 코딩
기타 : <textarea name="comment"></textarea>
<input type="submit" value="전송">
echo "<h2>입력된 회원 정보</h2>";
echo "이름 : ".$name."<br>";
echo "성별 : ".$gender."<br>";
echo "이메일 : ".$email."<br>";
echo "홈페이지 : ".$website."<br>";
foreach ($favtopic as $value) {
echo "<br>기타 : ".$comment;