폼메일 코드 수정

폼메일 코드 수정

QA

폼메일 코드 수정

본문

덕서리님이 올려주신 코드를 응용해서 작업중입니다.

 

이름,연락처, qna[문의유형] 값만 받고 싶은데 html에서 이메일 tr 을 삭제해버리면 아예 작동을 안하네요...

어떻게없앨 수 있을까요?

 

 


<meta charset="utf-8">
<?php
if(isset($_POST['email'])) {
$email_to = "*** 개인정보보호를 위한 이메일주소 노출방지 ***"; // 문의메일 받는 사람 메일 주소
$email_subject = "수강문의";
$email_subject = '=?UTF-8?B?'.base64_encode($email_subject).'?=';
function died($error) {
// your error code can go here
echo "<script> alert('이메일형식을확인해주세요.');";
echo "history.go(-1);";
echo "</script>";
die();
}
// validation expected data exists
if( !isset($_POST['first_name']) ||
!isset($_POST['phone_num']) ||
!isset($_POST['qna']) ||  // 이부분이 다중체크값!!!입니다.
!isset($_POST['email'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$first_name = $_POST['first_name']; // required
$phone_num = $_POST['phone_num']; // required
$email_from = $_POST['email']; // required
$list = $_POST['qna'];  // 이부분이 다중체크값!!!입니다.
echo $list[0];
echo $list[1];
$list = implode(', ', $_POST['qna']);
$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,4}$/';
if(!preg_match($email_exp,$email_from)) {
$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "성함 / 직책 : ".clean_string($first_name)."\n\n";
$email_message .= "문의내용 : ".clean_string($list)."\n\n";
$email_message .= "연락처 : ".clean_string($phone_num)."\n\n";
$email_message .= "이메일 : ".clean_string($email_from)."\n\n";  // 이부분이 다중체크값!!!입니다.
// create email headers
$headers = 'From: '.$email_from;
// 제목이 깨질경우 아래 캐릭터셋 적용
@mail($email_to, $email_subject, $email_message, $headers);
echo "<script> alert('상담 신청이 완료되었습니다.');";
echo "history.go(-1);";
echo "</script>";
?>
<?php
}
?>
 

 

 


<div class="contact_form application">
    <div class="row">
         <form name="contactform" method="post" action="formtest.php" class="main_form_wrap">
            <table>
               <tbody>
                 <tr>
                     <th scope="row_1"><label for="first_name">신청자<span class="required_star">*</span></label></th>
                     <td width="80%"><input id="nameinput" name="first_name" type="text" class="ipt" size="30" maxlength="50" placeholder="성함 / 직책을 입력해주세요." required=""></td>
                     </tr>
                 <tr class="multi_select">
                    <th scope="row_1"><label for="qna">문의 내용 <span class="small_p">[복수선택가능]</span><span class="required_star">*</span></label></th>
                    <td colspan="2">
                            <input type="checkbox" name="qna[]" class="check" value="사업제휴" id="test1"><label for="test1">사업제휴</label> <span style="margin-left:10px;display:inline-block;"></span>
                            <input type="checkbox" name="qna[]" class="check" value="방송/협찬" id="test2"><label for="test2">방송/협찬</label><span style="margin-left:10px;display:inline-block;"></span>
                            <input type="checkbox" name="qna[]" class="check" value="유통/판매" id="test3"><label for="test3">유통/판매</label><span style="margin-left:10px;display:inline-block;"></span>
                            <input type="checkbox" name="qna[]" class="check" value="홍보/마케팅" id="test4"><label for="test4">홍보/마케팅</label><span style="margin-left:10px;display:inline-block;"></span>
                            <input type="checkbox" name="qna[]" class="check" value="제안" id="test5"><label for="test5">제안</label><span style="margin-left:10px;display:inline-block;"></span><br>
                            <input type="checkbox" name="qna[]" class="check" value="프로모션" id="test6"><label for="test6">프로모션</label><span style="margin-left:10px;display:inline-block;"></span>
                            <input type="checkbox" name="qna[]" class="check" value="대량구매" id="test7"><label for="test7">대량구매</label><span style="margin-left:10px;display:inline-block;"></span>
                            <input type="checkbox" name="qna[]" class="check" value="오프라인 미팅요청" id="test8"><label for="test8">오프라인 미팅요청</label><span style="margin-left:10px;display:inline-block;"></span>
                        </td>
                    </tr>
                 <tr>
                      <th scope="row_1"><label for="phone_num">연락처 <span class="required_star">*</span></label></th>
                      <td width="80%"><input id="phoneinput" name="phone_num" type="text" class="ipt" size="30" maxlength="50" placeholder="연락처를 입력해주세요." required=""></td>
                      </tr>
                  <tr>
                     <th scope="row"><label for="email">이메일 주소  <span class="required_star">*</span></label></th>
                     <td><input id="mailinput" name="email" type="text" class="ipt" size="30" maxlength="80" placeholder="올바른 이메일 주소를 입력해주세요." required=""></td>
                     </tr>
                  <tr>
                     <td height="40" colspan="2" style="text-align:center"><input type="submit" value="문의하기" class="btn_submit"><input name="재설정" type="reset" value="다시작성" class="btn_submit"></td>
                     </tr>
                     <tr>
                         <td>
                             <input type="checkbox" name="chkAgree" id="w_check" value="1" class="chkBox" required="">
                            <label for="w_check"><a href="/web/renewal2016/customer/privacy_info.asp" target="_blank"><u>개인정보처리방침</u></a>에 동의 하시겠습니까?</label>
                         </td>
                     </tr>
               </tbody>
               </table>
            </form>
         </div>
      </div>

이 질문에 댓글 쓰기 :

답변 1


                  <tr>
                     <th scope="row"><label for="email">이메일 주소  <span class="required_star">*</span></label></th>
                     <td><input id="mailinput" name="email" type="text" class="ipt" size="30" maxlength="80" placeholder="올바른 이메일 주소를 입력해주세요." required=""></td>
                     </tr>

 

를 이렇게 변경하세요

<input id="mailinput" name="email" type="hidden" value="받는메일주소">

 

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

회원로그인

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