radio버튼으로 value 값을 받는 방법..
choish
4년 전
조회 2,574
</p>
<p><body></p>
<p> <form action="mixProcess.php" method="post"></p>
<p> <div class="area-container"></p>
<p>
</p>
<p> <legend>원하는 선크림 타입을 선택해주세요</legend></p>
<p>
</p>
<p> <input type="radio" name="type" value="physical" /> 무기자차</p>
<p> <input type="radio" name="type" value="chemical" /> 유기자차</p>
<p> </div></p>
<p>
</p>
<p><legend>주로 활동하는 장소를 선택해주세요</legend></p>
<p>
</p>
<p> <input type="radio" name="area" value="inside" /> 실내</p>
<p> <input type="radio" name="area" value="outside" /> 실외</p>
<p> </div></p>
<p>
</p>
<p><div class="next-botton"></p>
<p> <button type="submit" class="join-button">다음선택</button></p>
<p>
라디오 버튼으로 둘 중 하나를 선택하는 질문 두가지를 조합해서 거기에 맞게 html를 띄워주고싶은데요 ㅠ( 2x2 총 4가지의 경우의 수)
라디오버튼 value값을 어떻게 받아서 처리를 해야 if 문으로 조합 할 수 있나요?
form action = mixProcess.php 에 어떻게 라디오 value값을 넣고 어떻게 분기처리를 해야할까요?ㅜㅜ
댓글을 작성하려면 로그인이 필요합니다.
답변 1개
4년 전
* mixProcess.php
$type = $_POST['type'];
$area = $_POST['area'];
if ($type == '무기자차' && $area == 'inside') {
echo 'a';
} else if ($type == '무기자차' && $area == 'outside') {
echo 'b';
} else if ($type == '유기자차' && $area == 'inside') {
echo 'c';
} else if ($type == '유기자차' && $area == 'outside') {
echo 'd';
}
로그인 후 평가할 수 있습니다
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인