form 작동 오류 질문

form 작동 오류 질문

QA

form 작동 오류 질문

본문


<?php
include_once('./_common.php');
if ($is_guest)
    alert_close('회원만 조회하실 수 있습니다.');
$g5['title'] = $member['mb_name'].' 님의 재입고 SMS 알림 신청 내역';
include_once(G5_PATH.'/head.sub.php');
$sql = " select a.ss_id, a.it_id, a.ss_mbid, a.ss_hp, b.it_name
            from {$g5['g5_shop_item_stocksms_table']} a left join {$g5['g5_shop_item_table']} b on ( a.it_id = b.it_id )
            where a.ss_mbid IN ( '{$member['mb_id']}', '전체회원' )
            order by a.ss_id ";
$result = sql_query($sql);
?>
<!-- SMS 내역 시작 { -->
<form name="stocksms" action="./stocksmsupdate.php" method="post" onsubmit="return stocksms_submit(this);">
    <div id="coupon" class="new_win">
        <h1 id="win_title"><?php echo $g5['title'] ?></h1>
        <ul>
        <li>
            <label for="chkall" class="sound_only">알림요청 전체</label>
            <input type="checkbox" name="chkall" value="1" id="chkall" onclick="check_all(this.form)"> 전체선택
        </li>
        <?php
        $cp_count = 0;
        for($i=0; $row=sql_fetch_array($result); $i++) {
            $cp_count++;
        ?>
        <li>
            <div class="cou_top">
                <input type="checkbox" name="chk[]" value="<?php echo $i ?>" id="chk_<?php echo $i; ?>">
                <span class="cou_tit"><?php echo $row['it_id']; ?></span>
                <span class="cou_tit" style="margin-left:30px; max-width:350px;"><?php echo $row['it_name']; ?></span>
                <span class="cou_tit" style="margin-left:30px; float:right;"><?php echo $row['ss_hp']; ?></span>
            </div>
        </li>
        <?php
        }
        if(!$cp_count)
            echo '<li class="empty_li">신청하신 SMS 알림 내역이 없습니다.</li>';
        ?>
        </ul>
        <button type="button" onclick="window.close();" class="btn_close">창닫기</button>
    </div>
    <div class="btn_fixed_top">
        <input type="submit" name="act_button" value="선택삭제" onclick="document.pressed=this.value" class="btn btn_02">
    </div>
</form>
<script>
function stocksms_submit(f)
{
    if (!is_checked("chk[]")) {
        alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
        return false;
    }
    if(document.pressed == "선택삭제") {
        if(!confirm("선택한 자료를 정말 삭제하시겠습니까?")) {
            return false;
        }
    }
    return true;
}
</script>
<?php
include_once(G5_PATH.'/tail.sub.php');
?>

 

stocksmsupdate.php


<?php
include_once('./_common.php');
if ($is_guest)
    alert_close('회원만 조회하실 수 있습니다.');
if (!count($_POST['chk'])) {
    alert($_POST['act_button']." 하실 항목을 하나 이상 체크하세요.");
}
if ($_POST['act_button'] == "선택삭제") {
    for ($i=0; $i<count($_POST['chk']); $i++) {
        // 실제 번호를 넘김
        $k = $_POST['chk'][$i];
        $sss_id = (int) $_POST['ss_id'][$k];
        $sql = " delete from {$g5['g5_shop_item_stocksms_table']} where ss_id = '{$sss_id}' ";
        sql_query($sql);
    }
}

goto_url('./stocksms.php?');
?>

 

이렇게 작성했는데 일단 전체체크를 눌러도 전체가 체크되지 않고

 

선택하여 삭제버튼을 눌러도 아무 메세지도 뜨지 않고 삭제도 되지 않아요

 

뭐가 잘못된거죠? ㅠㅠ

이 질문에 댓글 쓰기 :

답변 1

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

회원로그인

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