글쓰기폼 2개일때 하나에서 올바른 사용 방법으로 해결방법 부탁드립니다.
본문
안녕하세요
메인에 상담신청 폼을 2개 넣으려고 합니다
아래 방식으로 불러오고 있는대
하나는 잘되는대 하나가 "올바른 방법으로 이용해 주세요" 이렇게
메세지가 뜹니다
한페이지에 폼을 두개 사용 하는 방법은 없을까요
게시판 스킨을 oline.php사용했구요.
<? include_once("customer1.php"); ?>
<? include_once("customer2.php"); ?> 이런식으로 불러오고 있습니다.
소스는 이렇습니다.
customer1.php
<?
$g5_path = ".."; // 그누보드가 있는 상대경로를 적어줌
?>
<script language="javascript">
var char_min = parseInt(<?=$write_min?>);
var char_max = parseInt(<?=$write_max?>);
</script>
<style type="text/css">
.form-box .form-con{display:inline-block; width:100%; margin-bottom:16px; box-sizing:border-box;}
.form-box .form-con .in_box{width: 100%;height: 48px;padding: 0 20px 0 20px;border: 1px solid #f6f6f6;background-color: #f6f6f6;color: #494949;line-height: 48px;outline: 0;}
.form-box .form-con ul li{display:table;width:100%;margin-bottom:16px;}
.form-box .form-con ul li .fl-name{float:left;width:15%;font-size: 14px;line-height:50px; vertical-align:middle;}
.form-box .form-con ul li .fr-con{float:left;width:80%;}
.form-box .form-con ul li .fr-con .text-box{diaplay:table;width:100%;}
.form-box .form-con ul li .fr-con .text-box input{width:34%;float:left;margin-left:1%;}
.form-box .form-con ul li .fr-con .text-box select{width:30%;float:left;}
.form-box .form-con ul li .fr-con textarea{height:164px;resize:none;}
.form-box .form-con .provision{display:table;width:100%;margin-top:20px; vertical-align: middle}
.form-box .form-con .provision label{cursor:pointer;font-weight:300;}
.form-box .form-con .provision label input{width:20px;height:20px;}
.form-box .form-con .provision label span{margin-left:5px;vertical-align: middle}
.form-box .form-con .provision a{padding:0 15px;height:35px;line-height:35px;font-size:12px;background:#999;color:#fff;display:inline-block;margin-left:10px;}
.form-box .receive-btn{margin-top:5px; float: right}
.form-box .receive-btn input{width: 176px;height:44px;font-size:16px;letter-spacing: -2px;background: #1773e9;border: none;color: #fff;cursor: pointer;margin-right: 30px}
@media (max-width: 600px){
.form-box .receive-btn input{padding:10px 0;}
.form-box .receive-btn{margin-top:5px; float: left}
.form-box .form-con ul li .fl-name{float:left;width:20%;font-size: 14px;line-height:50px; vertical-align:middle;}
.form-box .form-con ul li .fr-con{float:left;width:80%;}
.form-box .form-con .provision a{padding:0 10px;height:35px;line-height:35px;font-size:12px;background:#999;color:#fff;display:inline-block;margin-left:0px;}
}
</style>
<script type="text/javascript">
function checkFrm(obj) {
if(obj.wr_6.checked == false) {
alert('개인정보 활동동의에 체크해주세요.');
obj.wr_4.focus();
return false;
}
}
</script>
<div class="form-box" >
<form name=frm method=post action="<?=$g5['path']?>/bbs/write_update.php" onsubmit="return checkFrm(this);">
<input type="hidden" name="token" value=<?php echo get_write_token('incom') ?>>
<input type=hidden name=bo_table value="incom">
<input type=hidden name="wr_1" value="">
<input type=hidden name="wr_2" value="">
<input type=hidden name="wr_3" value="">
<input type=hidden name="wr_name" value="관리자">
<input type=hidden name="wr_subject" value="님 상담신청">
<input type=hidden name="wr_content" value="내용">
<input type=hidden name="ca_name" value="상담신청">
<div class="form-con">
<ul>
<li>
<span class="fl-name">이름</span>
<span class="fr-con">
<input class="in_box" type="text" name="wr_1" placeholder="이름을 입력하세요" required itemname="이름"/>
</span>
</li>
<li>
<span class="fl-name">희망차종</span>
<span class="fr-con">
<input class="in_box" type="text" name="wr_2" placeholder="ex) 뉴그렌져" required itemname="차종"/>
</span>
</li>
<li>
<span class="fl-name">연라처</span>
<span class="fr-con">
<input class="in_box" type="text" name="wr_3" placeholder="ex) *** 개인정보보호를 위한 휴대폰번호 노출방지 ***" required itemname="차종"/>
</span>
</li>
</ul>
<div class="provision">
<label for="provision-check">
<input id="provision-check" type="checkbox" name="wr_4" value="4" <?=$write[wr_4]?>/ >
<span>개인정보처리방침 동의</span>
</label>
<a href="#person_request2" class="open_modal">개인정보처리방침</a>
</div>
</div>
<div class="receive-btn">
<input name="image" type="submit" value="상담신청 하기" alt="상담신청 하기">
</div>
</form>
</div>
<!--//-->
customer2.php
<?
$g5_path = ".."; // 그누보드가 있는 상대경로를 적어줌
?>
<script language="javascript">
var char_min = parseInt(<?=$write_min?>);
var char_max = parseInt(<?=$write_max?>);
</script>
<style type="text/css">
.form-box .form-con{display:inline-block; width:100%; margin-bottom:16px; box-sizing:border-box;}
.form-box .form-con .in_box{width: 100%;height: 48px;padding: 0 20px 0 20px;border: 1px solid #f6f6f6;background-color: #f6f6f6;color: #494949;line-height: 48px;outline: 0;}
.form-box .form-con ul li{display:table;width:100%;margin-bottom:16px;}
.form-box .form-con ul li .fl-name{float:left;width:15%;font-size: 14px;line-height:50px; vertical-align:middle;}
.form-box .form-con ul li .fr-con{float:left;width:80%;}
.form-box .form-con ul li .fr-con .text-box{diaplay:table;width:100%;}
.form-box .form-con ul li .fr-con .text-box input{width:34%;float:left;margin-left:1%;}
.form-box .form-con ul li .fr-con .text-box select{width:30%;float:left;}
.form-box .form-con ul li .fr-con textarea{height:164px;resize:none;}
.form-box .form-con .provision{display:table;width:100%;margin-top:20px; vertical-align: middle}
.form-box .form-con .provision label{cursor:pointer;font-weight:300;}
.form-box .form-con .provision label input{width:20px;height:20px;}
.form-box .form-con .provision label span{margin-left:5px;vertical-align: middle}
.form-box .form-con .provision a{padding:0 15px;height:35px;line-height:35px;font-size:12px;background:#999;color:#fff;display:inline-block;margin-left:10px;}
.form-box .receive-btn{margin-top:5px; float: right}
.form-box .receive-btn input{width: 176px;height:44px;font-size:16px;letter-spacing: -2px;background: #1773e9;border: none;color: #fff;cursor: pointer;margin-right: 30px}
@media (max-width: 600px){
.form-box .receive-btn input{padding:10px 0;}
.form-box .receive-btn{margin-top:5px; float: left}
.form-box .form-con ul li .fl-name{float:left;width:20%;font-size: 14px;line-height:50px; vertical-align:middle;}
.form-box .form-con ul li .fr-con{float:left;width:80%;}
.form-box .form-con .provision a{padding:0 10px;height:35px;line-height:35px;font-size:12px;background:#999;color:#fff;display:inline-block;margin-left:10px;}
}
</style>
<script type="text/javascript">
function checkFrm2(obj) {
if(obj.wr_4.checked == false) {
alert('개인정보 활동동의에 체크해주세요.');
obj.wr_4.focus();
return false;
}
}
</script>
<div class="form-box" >
<form name=frm2 method=post action="<?=$g5['path']?>/bbs/write_update.php" onsubmit="return checkFrm2(this);">
<input type="hidden" name="token" value=<?php echo get_write_token('incom') ?>>
<input type=hidden name=bo_table value="incom">
<input type=hidden name="wr_1" value="">
<input type=hidden name="wr_2" value="">
<input type=hidden name="wr_3" value="">
<input type=hidden name="wr_name" value="관리자">
<input type=hidden name="wr_subject" value="님 상담신청">
<input type=hidden name="wr_content" value="내용">
<input type=hidden name="ca_name" value="상담신청">
<div class="form-con">
<ul>
<li>
<span class="fl-name">이름</span>
<span class="fr-con">
<input class="in_box" type="text" name="wr_1" placeholder="이름을 입력하세요" required itemname="이름"/>
</span>
</li>
<li>
<span class="fl-name">희망차종</span>
<span class="fr-con">
<input class="in_box" type="text" name="wr_2" placeholder="ex) 뉴그렌져" required itemname="차종"/>
</span>
</li>
<li>
<span class="fl-name">연라처</span>
<span class="fr-con">
<input class="in_box" type="text" name="wr_3" placeholder="ex) *** 개인정보보호를 위한 휴대폰번호 노출방지 ***" required itemname="차종"/>
</span>
</li>
</ul>
<div class="provision">
<label for="provision-check">
<input id="provision-check" type="checkbox" name="wr_4" value="4" <?=$write[wr_4]?>/ >
</label>
<span>개인정보처리방침 동의</span>
<a href="#person_request2" class="open_modal">개인정보처리방침</a>
</div>
</div>
<div class="receive-btn">
<input name="image" type="submit" value="상담신청 하기" alt="상담신청 하기">
</div>
</form>
</div>
<!--//-->
아래와 같이 form name도 변경했는대
올바른 방법으로 이용 하세요로 나옮니다
방법이 없을까요
한번 검토 부탁드립니다
<form name=frm method=post action="<?=$g5['path']?>/bbs/write_update.php" onsubmit="return checkFrm(this);">
->
<form name=frm2 method=post action="<?=$g5['path']?>/bbs/write_update.php" onsubmit="return checkFrm2(this);">
!-->!-->답변 2
아 이건 토큰 문제군요
<?php $token = get_write_token('incom'); ?>
<? include_once("customer1.php"); ?>
<? include_once("customer2.php"); ?>
인클루드 파일 위에 토큰생성을 한 변수에 담으시고
각 form에 <input type="hidden" name="token" value=<?php echo $token ?>>
이런식으로 변경해보세요
폼을 두개 동시에 서브밋하는게 아닌 이상 정상작동해야 정상일텐데요
해당 파일이 인클루드 되어있는 곳도 볼수있을까요?