폼 액션 질문 입니다.

폼 액션 질문 입니다.

QA

폼 액션 질문 입니다.

본문

확인창 뜨고 확인을 누르면 잘 넘어가는데

문제는 취소를 눌러도 이동해버리는데 머가 잘못됐을까요...

 


<form name="fwrite" id="fwrite" method="post">
					<input type="hidden" name="uid" value="<?php echo get_uniqid(); ?>">
					<input type="hidden" name="w" value="<?php echo $w ?>">
					<input type="hidden" name="bo_table" value="tour_order">
					<input type="hidden" name="wr_id" value="<?php echo $wr_id ?>">
				
					<input type="hidden" name="wr_1" value="sub04_1">
					<input type="hidden" name="wr_2" value="<?php echo $wr_id ?>">
					<input type="hidden" name="wr_3" value="<?php echo $view['wr_subject'] ?>">
					<input type="hidden" name="wr_4" value="<?php echo $member['mb_name'] ?>">
					<input type="hidden" name="wr_5" value="<?php echo $member['mb_hp'] ?>">
					<input type="hidden" name="wr_subject" value="<?php echo $member['mb_name'] ?>님 예약">
					<input type="hidden" name="wr_content" value="<?php echo $member['mb_name'] ?>님 예약">
 
					<input type="submit" value="예약하기" id="order_btn" onclick="order()">
 
					</form>
 
<script>
function order(url)
{
 
 
   if(!confirm("<?php echo $view['wr_subject'] ?>을 예약하시겠습니까?")) {
		return false;
   }
	
	document.fwrite.action = './write_update_order.php';
	document.fwrite.submit();
	
}
 
 
</script>

이 질문에 댓글 쓰기 :

답변 2

 

submit 버튼에 onclick 액션을 주지마시고 form 태그에 onsubmit에 하시면 됩니다.

 

<form name="fwrite" id="fwrite" method="post" onsubmit="return order()">
					<input type="hidden" name="uid" value="<?php echo get_uniqid(); ?>">
					<input type="hidden" name="w" value="<?php echo $w ?>">
					<input type="hidden" name="bo_table" value="tour_order">
					<input type="hidden" name="wr_id" value="<?php echo $wr_id ?>">
				
					<input type="hidden" name="wr_1" value="sub04_1">
					<input type="hidden" name="wr_2" value="<?php echo $wr_id ?>">
					<input type="hidden" name="wr_3" value="<?php echo $view['wr_subject'] ?>">
					<input type="hidden" name="wr_4" value="<?php echo $member['mb_name'] ?>">
					<input type="hidden" name="wr_5" value="<?php echo $member['mb_hp'] ?>">
					<input type="hidden" name="wr_subject" value="<?php echo $member['mb_name'] ?>님 예약">
					<input type="hidden" name="wr_content" value="<?php echo $member['mb_name'] ?>님 예약">
 
					<input type="submit" value="예약하기" id="order_btn" >
 
					</form>
 
<script>
function order()
{
 
 
   if(!confirm("<?php echo $view['wr_subject'] ?>을 예약하시겠습니까?")) {
		return false;
   }
	
	document.fwrite.action = './write_update_order.php';
	document.fwrite.submit();
	
}
 
 
</script>

 

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

회원로그인

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