폼메일 직접입력/ 종류에서 선택 아닌 직접입력 채택완료
폼메일 작성 중
제품 종류를 선택하는 칸이 있는데
직접입력할 수 있도록 만들어놨습니다
그런데 발송하여
기업명 : test
성함 : test/test
핸드폰번호 : 010-1234-5678
이메일 주소 : silver@.com
주소 : 인천
제품 : 가습기
제품 종류 :
고장 내용 : 냉방기1 이상
내용 : test
첨부파일 : 3.png
이렇게 비어지네요ㅠ
해당부분 코드는
Copy
<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입니다
Copy
$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>";
}
제품종류 저부분이 오류인건 알겠는데
어떤 코드가 오류인지 어떻게 해야 하는지ㅠㅠ 도와주세요
답변 1개
채택된 답변
+20 포인트
블랙캣77
1년 전
직접 입력에 id만 있고 name 이 없는거 같네요 name도 지정해주세요 동일하게요.
로그인 후 평가할 수 있습니다
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인