폼 액션 질문 입니다.
본문
확인창 뜨고 확인을 누르면 잘 넘어가는데
문제는 취소를 눌러도 이동해버리는데 머가 잘못됐을까요...
<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>
앗 !! 아.. 감사합니다
지식 습득.. 멀 작업 할때마다 까먹고 잊어버리고..
좋은 하루 되세요~
답변을 작성하시기 전에 로그인 해주세요.