테스트 사이트 - 개발 중인 베타 버전입니다

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

sliverzero 1년 전 조회 2,019

폼메일 작성 중

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

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

 

그런데 발송하여

 

기업명 : test
성함 : test/test
핸드폰번호 : 010-1234-5678
이메일 주소 : silver@.com
주소 : 인천
제품 : 가습기
제품 종류 :
고장 내용 : 냉방기1 이상
내용 : test
첨부파일 : https://korac2024.mycafe24.com/home/data/mail/%EC%9D%B4%EC%98%A8%EB%B3%80%EA%B8%B0%EC%84%B8%EC%A0%95%EC%A0%9C_%EC%8D%B8%EB%84%A4%EC%9D%BC_1_2_3.png" rel="noreferrer noopener" target="_blank">3.png

 

이렇게 비어지네요ㅠ

 

해당부분 코드는

</p>

<p><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></p>

<p>

 

아래는 send.php입니다

</p>

<p>$email_message .= "기업명 : ".clean_string($company)."

";//다중체크

  $email_message .= "성함 : ".clean_string($name)."

";

    $email_message .= "핸드폰번호 : ".clean_string($tel)."

";

  $email_message .= "이메일 주소 : ".clean_string($email)."

";

  $email_message .= "주소 : ".clean_string($loca)."

";

  $email_message .= "제품 : ".clean_string($product)."

";</p>

<p>  // 직접 입력한 내용이 있다면 해당 내용을 가져와서 전송

  if(isset($_POST['subproduct'])) {

    $subproduct = $_POST['subproduct'];

    if($subproduct == '직접입력') {

        $directInput = clean_string($_POST['directInput']);

        // 직접 입력한 내용이 비어 있지 않을 경우에만 제품 종류(직접입력)을 추가

        if (!empty($directInput)) {

            $email_message .= "제품 종류(직접입력) : ".clean_string($directInput). "

";

        } else {

            $subproduct = ''; // 직접 입력한 내용이 없으면 제품 종류를 빈 문자열로 설정

        }

    }

    if ($subproduct != '직접입력') {

        $email_message .= "제품 종류 : ".clean_string($subproduct)."

";

    }

}</p>

<p>  $email_message .= "고장 내용 : ".clean_string($fix)."

";

  $email_message .= "내용 : ".clean_string(nl2br($content))."

";</p>

<p>

  if(!empty($filename) && file_exists($target_file)) {

      $email_message .= "첨부파일 : <a target='_blank' href='" . $file_url . "' download>".$filename."</a>

";

  } else {

      $email_message .= "첨부파일 : 문제있음

";

  }</p>

<p>

 

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

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

댓글을 작성하려면 로그인이 필요합니다.

답변 1개

채택된 답변
+20 포인트
1년 전

직접 입력에 id만 있고 name 이 없는거 같네요 name도 지정해주세요 동일하게요.

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

s
sliverzero
1년 전
감사합니다 선생님!!

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인