폼메일 직접입력/ 종류에서 선택 아닌 직접입력

폼메일 직접입력/ 종류에서 선택 아닌 직접입력

QA

폼메일 직접입력/ 종류에서 선택 아닌 직접입력

본문

폼메일 작성 중

제품 종류를 선택하는 칸이 있는데

직접입력할 수 있도록 만들어놨습니다

 

그런데 발송하여

 

기업명 : test
성함 : test/test
핸드폰번호 : *** 개인정보보호를 위한 휴대폰번호 노출방지 ***
이메일 주소 : silver@.com
주소 : 인천
제품 : 가습기
제품 종류 :
고장 내용 : 냉방기1 이상
내용 : test
첨부파일 : 3.png

 

이렇게 비어지네요ㅠ

 

해당부분 코드는


<li>
                  <label class="lbl" for="subproduct">제품 종류<span class="txt_red">*</span></label>
                  <div class="desc">
                      <select class="dxee-input full" name="subproduct" id="depth2" required>
                        <option value="">제품 종류를 선택하세요</option>
                        <option value="3RT" class="depth2_op depth2_a depth2_b" style="display:none;">3RT</option>
                        <option value="5RT" class="depth2_op depth2_a depth2_b" style="display:none;">5RT</option>
                        <option value="6RT" class="depth2_op depth2_a depth2_b" style="display:none;">6RT</option>
                        <option value="7.5RT" class="depth2_op depth2_a depth2_b" style="display:none;">7.5RT</option>
                        <option value="10RT" class="depth2_op depth2_a depth2_b" style="display:none;">10RT</option>
                        <option value="15RT" class="depth2_op depth2_a depth2_b" style="display:none;">15RT</option>
                        <option value="20RT" class="depth2_op depth2_a depth2_b" style="display:none;">20RT</option>
                        <option value="모르겠음" class="depth2_op depth2_a depth2_b" style="display:none;">모르겠음</option>
                        <option value="직접입력" class="depth2_op depth2_c" style="display:none;">직접입력</option>
                        <option value="모르겠음" class="depth2_op depth2_c" style="display:none;">모르겠음</option>
                      </select>
                      <!-- 추가: 직접 입력을 위한 입력칸 -->
                      <input type="text" id="directInput" class="dxee-input full" style="display:none;" placeholder="직접 입력">
                  </div>
              </li>

 

아래는 send.php입니다


$email_message .= "기업명 : ".clean_string($company)."<br><br>";//다중체크
  $email_message .= "성함 : ".clean_string($name)."<br><br>";
    $email_message .= "핸드폰번호 : ".clean_string($tel)."<br><br>";
  $email_message .= "이메일 주소 : ".clean_string($email)."<br><br>";
  $email_message .= "주소 : ".clean_string($loca)."<br><br>";
  $email_message .= "제품 : ".clean_string($product)."<br><br>";
  // 직접 입력한 내용이 있다면 해당 내용을 가져와서 전송
  if(isset($_POST['subproduct'])) {
    $subproduct = $_POST['subproduct'];
    if($subproduct == '직접입력') {
        $directInput = clean_string($_POST['directInput']);
        // 직접 입력한 내용이 비어 있지 않을 경우에만 제품 종류(직접입력)을 추가
        if (!empty($directInput)) {
            $email_message .= "제품 종류(직접입력) : ".clean_string($directInput). "<br><br>";
        } else {
            $subproduct = ''; // 직접 입력한 내용이 없으면 제품 종류를 빈 문자열로 설정
        }
    }
    if ($subproduct != '직접입력') {
        $email_message .= "제품 종류 : ".clean_string($subproduct)."<br><br>";
    }
}
  $email_message .= "고장 내용 : ".clean_string($fix)."<br><br>";
  $email_message .= "내용 : ".clean_string(nl2br($content))."<br><br>";

  if(!empty($filename) && file_exists($target_file)) {
      $email_message .= "첨부파일 : <a target='_blank' href='" . $file_url . "' download>".$filename."</a><br><br>";
  } else {
      $email_message .= "첨부파일 : 문제있음<br><br>";
  }

 

제품종류 저부분이 오류인건 알겠는데

어떤 코드가 오류인지 어떻게 해야 하는지ㅠㅠ 도와주세요

이 질문에 댓글 쓰기 :

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

회원로그인

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