radio버튼으로 value 값을 받는 방법..

radio버튼으로 value 값을 받는 방법..

QA

radio버튼으로 value 값을 받는 방법..

본문

 
<body>
    <form action="mixProcess.php" method="post">
      <div class="area-container">
          <br><br>
        <legend>원하는 선크림 타입을 선택해주세요</legend>
        <br>
        <input type="radio" name="type" value="physical" /> 무기자차
        <input type="radio" name="type" value="chemical" /> 유기자차
      </div>
      <br>
<legend>주로 활동하는 장소를 선택해주세요</legend>
        <br>
        <input type="radio" name="area" value="inside" /> 실내
        <input type="radio" name="area" value="outside" /> 실외
      </div>
      <br><br>
<div class="next-botton">
        <button type="submit" class="join-button">다음선택</button>

 

 

라디오 버튼으로 둘 중 하나를 선택하는 질문 두가지를 조합해서 거기에 맞게 html를 띄워주고싶은데요 ㅠ( 2x2 총 4가지의 경우의 수)

 

라디오버튼 value값을 어떻게 받아서 처리를 해야 if 문으로 조합 할 수 있나요? 

 

form action = mixProcess.php 에 어떻게 라디오 value값을 넣고 어떻게 분기처리를 해야할까요?ㅜㅜ

 

 

이 질문에 댓글 쓰기 :

답변 1

* 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';

}

답변을 작성하시기 전에 로그인 해주세요.
전체 125,873 | RSS
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT