여분필드값 일부만 데이터가 안넘어갑니다 일부는 잘 저장됨

여분필드값 일부만 데이터가 안넘어갑니다 일부는 잘 저장됨

QA

여분필드값 일부만 데이터가 안넘어갑니다 일부는 잘 저장됨

본문

공부의 목적으로 게시판을 하나 만들고

shop/orderaddress.php 쪽의 배송지 목록과 연동하려고 해보고있습니다!

 

목적 : 게시판을 하나 만들어서 게시글 작성시에 배송지주소록에 등록이 되도록 하고싶은데

g5_shop_oder_address 테이블을 확인해보면

ad_zip1, ad_zip2, ad_addr3, ad_jibeon 데이터가 넘어오지 않습니다

어떤 문제인지 도저히 해결이 안됩니다!

 

write_update.skin.php 파일


// 주소
$wr_5 = "$ex_zip1|$ex_zip2|$ex_addr1|$ex_addr2|$ex_addr3|$ex_jibeon";
// $wr_5 = "$ex_zip|$ex_addr1|$ex_addr2|$ex_addr3|$ex_jibeon";   -> 이렇게 ex_zip 으로 해도 안쪼개지고 $ex_zip1|$ex_zip2 해도 안됨
sql_query(" update $write_table set wr_5 = '$wr_5' where wr_id = '$wr_id' ");
//$hp =  "$wr_1-$wr_2-$wr_3";

$sql2 = " insert into {$g5['g5_shop_order_address_table']}
            set
                mb_id       = '{$member['mb_id']}',
                ad_subject  = '$wr_subject',
                ad_default  = '$ad_default',
                ad_name     = '$wr_name',
                ad_tel      = '$wr_1$wr_2$wr_3',
                ad_hp       = '$wr_1$wr_2$wr_3',
                ad_zip1     = '$ex_zip1',
                ad_zip2     = '$ex_zip2',
                ad_addr1    = '$ex_addr1',
                ad_addr2    = '$ex_addr2',
                ad_addr3    = '$ex_addr3',
                ad_jibeon   = '$ex_jibeon'  ";
sql_query($sql2);
 

 

write.skin.php 파일은 전문을 남기겠습니다

테스트 가능하신분 계시면 한번 확인해주세요 ㅠ 어렵네요

 


<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0);
add_javascript(G5_POSTCODE_JS, 0); //다음 주소 js

// 주소입력
$addr = explode('|',$write['wr_5']);
//$ex_zip  = $addr2[0];
$ex_zip           = preg_replace('/[^0-9]/', '', $addr[0]);
$ex_zip1          = substr($ex_zip, 0, 3);
$ex_zip2          = substr($ex_zip, 3);
$ex_addr3  = $addr[1];
$ex_addr4  = $addr[2];
$ex_addr5  = $addr[3];
$ex_jibeon  = $addr[4];
//주소입력
// $addr = explode('|',$write['wr_5']);
// $ex_zip  = $addr[0];
// $ex_addr3  = $addr[1];
// $ex_addr4  = $addr[2];
// $ex_addr5  = $addr[3];
// $ex_jibeon  = $addr[4];

// 회원정보에 입력된 개인정보 자동입력
if ($w == '' && $member['mb_id']) {
    $ex_zip1 = $member['mb_zip1'] + $member['mb_zip2'];
    $ex_addr1 = $member['mb_addr1'];
    $ex_addr2 = $member['mb_addr2'];
    $ex_addr3 = $member['mb_addr3'];
}
?>
<section id="bo_w">
    <h2 id="container_title"><?php echo $g5['title'] ?></h2>
    <!-- 게시물 작성/수정 시작 { -->
    <form name="fwrite" id="fwrite" action="<?php echo $action_url ?>" onsubmit="return fwrite_submit(this);" method="post" enctype="multipart/form-data" autocomplete="off" style="width:<?php echo $width; ?>">
    <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="<?php echo $bo_table ?>">
    <input type="hidden" name="wr_id" value="<?php echo $wr_id ?>">
    <input type="hidden" name="sca" value="<?php echo $sca ?>">
    <input type="hidden" name="sfl" value="<?php echo $sfl ?>">
    <input type="hidden" name="stx" value="<?php echo $stx ?>">
    <input type="hidden" name="spt" value="<?php echo $spt ?>">
    <input type="hidden" name="sst" value="<?php echo $sst ?>">
    <input type="hidden" name="sod" value="<?php echo $sod ?>">
    <input type="hidden" name="page" value="<?php echo $page ?>">
    <?php
    $option = '';
    $option_hidden = '';
    if ($is_notice || $is_html || $is_secret || $is_mail) {
        $option = '';
        if ($is_notice) {
            $option .= "\n".'<input type="checkbox" id="notice" name="notice" value="1" '.$notice_checked.'>'."\n".'<label for="notice">공지</label>';
        }
        if ($is_html) {
            if ($is_dhtml_editor) {
                $option_hidden .= '<input type="hidden" value="html1" name="html">';
            } else {
                $option .= "\n".'<input type="checkbox" id="html" name="html" onclick="html_auto_br(this);" value="'.$html_value.'" '.$html_checked.'>'."\n".'<label for="html">html</label>';
            }
        }
        if ($is_secret) {
            if ($is_admin || $is_secret==1) {
                $option .= "\n".'<input type="checkbox" id="secret" name="secret" value="secret" '.$secret_checked.'>'."\n".'<label for="secret">비밀글</label>';
            } else {
                $option_hidden .= '<input type="hidden" name="secret" value="secret">';
            }
        }
        if ($is_mail) {
            $option .= "\n".'<input type="checkbox" id="mail" name="mail" value="mail" '.$recv_email_checked.'>'."\n".'<label for="mail">답변메일받기</label>';
        }
    }
    echo $option_hidden;
    ?>
    <div class="tbl_frm01 tbl_wrap">
        <table>
        <tbody>
        <?php if ($is_category) { ?>
        <tr>
            <th scope="row"><label for="ca_name">상담분류/유형<strong class="sound_only">필수</strong></label></th>
            <td>
                <select name="ca_name" id="ca_name" required class="required" >
                    <option value="">선택하세요</option>
                    <?php echo $category_option ?>
                </select>
            </td>
        </tr>
        <?php } ?>
      <?php if ($is_name) { ?>
      <tr>
            <th scope="row"><label for="wr_name">이름<strong class="sound_only">필수</strong></label></th>
            <td><input type="text" name="wr_name" value="<?php echo $member['mb_name']?>" id="wr_name" required class="frm_input required" size="10" maxlength="20"></td>
      </tr>
    <?php } else { ?>
      <tr>
        <th scope="row"><label for="wr_name">고객성명</label></th>
              <td><input name="wr_name" type="text" value="<?php echo $member['mb_name']?>"required  class="frm_input wr_name required" maxlength="10" itemname="고객성명"/>
              </td>
      </tr>
    <?php } ?>
      <?php if ($is_password) { ?>
      <tr>
          <th scope="row"><label for="wr_password">비밀번호<strong class="sound_only">필수</strong></label></th>
          <td><input type="password" name="wr_password" id="wr_password" <?php echo $password_required ?> class="frm_input required <?php echo $password_required ?>" maxlength="20"></td>
      </tr>
      <?php } ?>
        <tr>
            <th scope="row"><label for="wr_1" >연락처</label></th>
            <td><select name="wr_1" itemname="휴대폰" required style="" class="frm_input wr_1" style="">
                        <option value="010">010</option>
                        <option value="011">011</option>
                        <option value="016">016</option>
                        <option value="017">017</option>
                        <option value="018">018</option>
                        <option value="019">019</option>
                     </select>
            <input name="wr_2" type="text" required  class="frm_input wr_2"  maxlength="4" itemname="휴대폰"/>
            <input name="wr_3" type="text" required  class="frm_input wr_3"  maxlength="4" itemname="휴대폰"/>
               </td>
        </tr>
              <tr>
            <th scope="row"><label for="wr_email">이메일</label></th>
            <td><input type="text" name="wr_email" value="<?php echo $email ?>" id="wr_email" class="frm_input email" size="50" maxlength="100"></td>
          </tr>

          <tr>
            <th scope="row"><label for="wr_5">주소</label></th>
            <td class="write_div">
                <label for="ex_zip" class="sound_only">우편번호</label>
                <input type="text" name="ex_zip" value="<?php echo $ex_zip1; ?><?php echo $ex_zip2; ?>" id="ex_zip"  class="frm_input" size="8" maxlength="6">
                <button type="button" class="btn_frmline" onclick="win_zip('fwrite', 'ex_zip', 'ex_addr1', 'ex_addr2', 'ex_addr3', 'ex_jibeon');">주소 검색</button>
                <!-- <button type="button" class="btn_frmline" onclick="win_zip('fwrite', 'ex_zip', 'ex_addr1', 'ex_addr2', 'ex_addr3', 'ex_jibeon');">배송지</button> --><br />
                <input type="text" name="ex_addr1" value="<?php echo $ex_addr1; ?>" id="ex_addr1" class="frm_input frm_address" size="50">
                <label for="ex_addr1">기본주소</label><br>
                <input type="text" name="ex_addr2" value="<?php echo $ex_addr2; ?>" id="ex_addr2" class="frm_input frm_address" size="50">
                <label for="ex_addr2">상세주소</label><br>
                <input type="text" name="ex_addr3" value="<?php echo $ex_addr3; ?>" id="ex_addr3" class="frm_input frm_address" size="50" readonly="readonly">
                <label for="ex_addr3">참고항목</label>
                <input type="hidden" name="ex_jibeon" value="<?php echo $ex_jibeon; ?>">
            </td>
          </tr>
        <tr>
            <th scope="row"><label for="wr_subject">배송지명<strong class="sound_only">필수</strong></label></th>
            <td>
                <div id="autosave_wrapper">
                    <input type="text" name="wr_subject" value="<?php echo $subject ?>" id="wr_subject" required class="frm_input required" size="50" maxlength="255">
                    <input type="checkbox" name="ad_default" id="ad_default" value="1">
                    <label for="ad_default">기본배송지로 설정</label>
                </div>
            </td>
        </tr>
<input type="hidden" name="wr_content" value="회수 요청이 접수되었습니다.">
        <?php if ($is_guest) { //자동등록방지  ?>
        <tr>
            <th scope="row">자동등록방지</th>
            <td>
                <?php echo $captcha_html ?>
            </td>
        </tr>
        <?php } ?>
        </tbody>
        </table>
    </div>
    <div class="btn_confirm">
        <input type="submit" value="작성완료" id="btn_submit" accesskey="s" class="btn_submit">
        <a href="./board.php?bo_table=<?php echo $bo_table ?>" class="btn_cancel">취소</a>
    </div>
    </form>
<form name="forderform" id="forderform" method="post" action="<?php echo $order_action_url; ?>" autocomplete="off">
            <!-- 받으시는 분 입력 시작 { -->
            <section id="sod_frm_taker">
                <h2>받으시는 분</h2>
                <div class="tbl_frm01 tbl_wrap">
                    <table>
                    <tbody>
                    <?php
                    $addr_list = '';
                    if($is_member) {
                        // 기본배송지
                        $sql = " select *
                                    from {$g5['g5_shop_order_address_table']}
                                    where mb_id = '{$member['mb_id']}'
                                      and ad_default = '1' ";
                        $row = sql_fetch($sql);
                        if(isset($row['ad_id']) && $row['ad_id']) {
                            //$val1 = $row['ad_name'].$sep.$row['ad_tel'].$sep.$row['ad_hp'].$sep.$row['ad_zip1'].$sep.$row['ad_zip2'].$sep.$row['ad_addr1'].$sep.$row['ad_addr2'].$sep.$row['ad_addr3'].$sep.$row['ad_jibeon'].$sep.$row['ad_subject'];
                            $val1 = $row['ad_name'].$sep.$row['ad_tel'].$sep.$row['ad_hp'].$sep.$row['ad_zip1'].$sep.$row['ad_zip2'].$sep.$row['ad_addr1'].$sep.$row['ad_addr2'].$sep.$row['ad_addr3'].$sep.$row['ad_jibeon'].$sep.$row['ad_subject'];
                            $addr_list .= '<input type="radio" name="ad_sel_addr" value="'.get_text($val1).'" id="ad_sel_addr_def">'.PHP_EOL;
                            $addr_list .= '<label for="ad_sel_addr_def">기본배송지</label>'.PHP_EOL;
                        }
                        // 최근배송지
                        $sql = " select *
                                    from {$g5['g5_shop_order_address_table']}
                                    where mb_id = '{$member['mb_id']}'
                                      and ad_default = '0'
                                    order by ad_id desc
                                    limit 1 ";
                        $result = sql_query($sql);
                        for($i=0; $row=sql_fetch_array($result); $i++) {
                            $val1 = $row['ad_name'].$sep.$row['ad_tel'].$sep.$row['ad_hp'].$sep.$row['ad_zip1'].$sep.$row['ad_zip2'].$sep.$row['ad_addr1'].$sep.$row['ad_addr2'].$sep.$row['ad_addr3'].$sep.$row['ad_jibeon'].$sep.$row['ad_subject'];
                            $val2 = '<label for="ad_sel_addr_'.($i+1).'">최근배송지('.($row['ad_subject'] ? get_text($row['ad_subject']) : get_text($row['ad_name'])).')</label>';
                            $addr_list .= '<input type="radio" name="ad_sel_addr" value="'.get_text($val1).'" id="ad_sel_addr_'.($i+1).'"> '.PHP_EOL.$val2.PHP_EOL;
                        }
                        $addr_list .= '<input type="radio" name="ad_sel_addr" value="new" id="od_sel_addr_new">'.PHP_EOL;
                        $addr_list .= '<label for="od_sel_addr_new">신규배송지</label>'.PHP_EOL;
                        $addr_list .='<a href="'.G5_SHOP_URL.'/orderaddress2.php" id="order_address" class="btn_frmline">배송지목록</a>';
                    }
                    ?>
                    <tr>
                        <th scope="row">배송지선택</th>
                        <td>
                                      <div class="order_choice_place">
                                      <?php echo $addr_list; ?>
                                      </div>
                        </td>
                    </tr>
                    <?php if($is_member) { ?>
                    <tr>
                        <th scope="row"><label for="ad_subject">배송지명</label></th>
                        <td>
                            <input type="text" name="ad_subject" id="ad_subject" class="frm_input" maxlength="20">
                            <input type="checkbox" name="ad_default" id="ad_default" value="1">
                            <label for="ad_default">기본배송지로 설정</label>
                        </td>
                    </tr>
                    <?php } ?>
                    <tr>
                        <th scope="row"><label for="od_b_name">이름<strong class="sound_only"> 필수</strong></label></th>
                        <td><input type="text" name="od_b_name" id="od_b_name" required class="frm_input required" maxlength="20"></td>
                    </tr>
                    <tr>
                        <th scope="row"><label for="od_b_tel">전화번호<strong class="sound_only"> 필수</strong></label></th>
                        <td><input type="text" name="od_b_tel" id="od_b_tel" required class="frm_input required" maxlength="20"></td>
                    </tr>
                    <tr>
                        <th scope="row"><label for="od_b_hp">핸드폰</label></th>
                        <td><input type="text" name="od_b_hp" id="od_b_hp" class="frm_input" maxlength="20"></td>
                    </tr>

                    <tr>
                        <th scope="row">주소</th>
                        <td id="sod_frm_addr">
                            <label for="od_b_zip" class="sound_only">우편번호<strong class="sound_only"> 필수</strong></label>
                            <input type="text" name="od_b_zip" id="od_b_zip" required class="frm_input required" size="8" maxlength="6" placeholder="우편번호">
                            <button type="button" class="btn_address" onclick="win_zip('forderform', 'od_b_zip', 'od_b_addr1', 'od_b_addr2', 'od_b_addr3', 'od_b_addr_jibeon');">주소 검색</button><br>
                            <input type="text" name="od_b_addr1" id="od_b_addr1" required class="frm_input frm_address required" size="60" placeholder="기본주소">
                            <label for="od_b_addr1" class="sound_only">기본주소<strong> 필수</strong></label><br>
                            <input type="text" name="od_b_addr2" id="od_b_addr2" class="frm_input frm_address" size="60" placeholder="상세주소">
                            <label for="od_b_addr2" class="sound_only">상세주소</label>
                            <br>
                            <input type="text" name="od_b_addr3" id="od_b_addr3" readonly="readonly" class="frm_input frm_address" size="60" placeholder="참고항목">
                            <label for="od_b_addr3" class="sound_only">참고항목</label><br>
                            <input type="hidden" name="od_b_addr_jibeon" value="">
                        </td>
                    </tr>
                    <tr>
                        <th scope="row"><label for="od_memo">전하실말씀</label></th>
                        <td><textarea name="od_memo" id="od_memo"></textarea></td>
                    </tr>
                    </tbody>
                    </table>
                </div>
            </section>
            <!-- } 받으시는 분 입력 끝 -->
          </form>
            <script>
                // 배송지선택
                $("input[name=ad_sel_addr]").on("click", function() {
                    var addr = $(this).val().split(String.fromCharCode(30));
                    if (addr[0] == "same") {
                        gumae2baesong();
                    } else {
                        if(addr[0] == "new") {
                            for(i=0; i<10; i++) {
                                addr[i] = "";
                            }
                        }
/*
              var f = document.forderform;
              f.od_b_name.value        = addr[0];
              f.od_b_tel.value         = addr[1];
              f.od_b_hp.value          = addr[2];
              f.od_b_zip.value         = addr[3] + addr[4];
              f.od_b_addr1.value       = addr[5];
              f.od_b_addr2.value       = addr[6];
              f.od_b_addr3.value       = addr[7];
              f.od_b_addr_jibeon.value = addr[8];
              f.ad_subject.value       = addr[9];
*/
              var f = document.fwrite;
              f.wr_name.value        = addr[0];
              //f.od_b_tel.value       = addr[1];
              //f.od_b_hp.value        = addr[2];
              f.ex_zip.value         = addr[3] + addr[4];
              f.ex_addr1.value       = addr[5];
              f.ex_addr2.value       = addr[6];
              f.ex_addr3.value       = addr[7];
              f.ex_jibeon.value      = addr[8];
              f.wr_subject.value     = addr[9];
              //var hp  = addr[2].replace(/[^0-9]/g, "");
              //f.wr_2.value  = addr[2].substr(hp, 4, 4);
              //f.wr_3.value  = addr[2].substr(hp, 9, 4);

                        var zip1 = addr[3].replace(/[^0-9]/g, "");
                        var zip2 = addr[4].replace(/[^0-9]/g, "");
                        var code = String(zip1) + String(zip2);
                        if(zipcode != code) {
                            calculate_sendcost(code);
                        }
                    }
                });
                // 배송지목록
                $("#order_address").on("click", function() {
                    var url = this.href;
                    window.open(url, "win_address", "left=100,top=100,width=800,height=600,scrollbars=1");
                    return false;
                });
            </script>

    <script>
    <?php if($write_min || $write_max) { ?>
    // 글자수 제한
    var char_min = parseInt(<?php echo $write_min; ?>); // 최소
    var char_max = parseInt(<?php echo $write_max; ?>); // 최대
    check_byte("wr_content", "char_count");
    $(function() {
        $("#wr_content").on("keyup", function() {
            check_byte("wr_content", "char_count");
        });
    });
    <?php } ?>
    function html_auto_br(obj)
    {
        if (obj.checked) {
            result = confirm("자동 줄바꿈을 하시겠습니까?\n\n자동 줄바꿈은 게시물 내용중 줄바뀐 곳을<br>태그로 변환하는 기능입니다.");
            if (result)
                obj.value = "html2";
            else
                obj.value = "html1";
        }
        else
            obj.value = "";
    }
    function fwrite_submit(f)
    {
      var wr_content_editor_data = oEditors.getById['wr_content'].getIR();
      oEditors.getById['wr_content'].exec('UPDATE_CONTENTS_FIELD', []);
      if(jQuery.inArray(document.getElementById('wr_content').value.toLowerCase().replace(/^\s*|\s*$/g, ''), [' ','<p> </p>','<p><br></p>','<div><br></div>','<p></p>','<br>','']) != -1){
        document.getElementById('wr_content').value=' ';
        wr_content_editor_data = ' '
      }
      if (!wr_content_editor_data || jQuery.inArray(wr_content_editor_data.toLowerCase(), ['<p><br></p>','<p></p>','<br>']) != -1) {
        alert("내용을 입력해 주십시오.");
        oEditors.getById['wr_content'].exec('FOCUS');
        return false;
      }
        <?php echo $editor_js; // 에디터 사용시 자바스크립트에서 내용을 폼필드로 넣어주며 내용이 입력되었는지 검사함   ?>
        var subject = "";
        var content = "";
        $.ajax({
            url: g5_bbs_url+"/ajax.filter.php",
            type: "POST",
            data: {
                "subject": f.wr_subject.value,
                "content": f.wr_content.value
            },
            dataType: "json",
            async: false,
            cache: false,
            success: function(data, textStatus) {
                subject = data.subject;
                content = data.content;
            }
        });
        if (subject) {
            alert("제목에 금지단어('"+subject+"')가 포함되어있습니다");
            f.wr_subject.focus();
            return false;
        }
        if (content) {
            alert("내용에 금지단어('"+content+"')가 포함되어있습니다");
            if (typeof(ed_wr_content) != "undefined")
                ed_wr_content.returnFalse();
            else
                f.wr_content.focus();
            return false;
        }
        if (document.getElementById("char_count")) {
            if (char_min > 0 || char_max > 0) {
                var cnt = parseInt(check_byte("wr_content", "char_count"));
                if (char_min > 0 && char_min > cnt) {
                    alert("내용은 "+char_min+"글자 이상 쓰셔야 합니다.");
                    return false;
                }
                else if (char_max > 0 && char_max < cnt) {
                    alert("내용은 "+char_max+"글자 이하로 쓰셔야 합니다.");
                    return false;
                }
            }
        }
        <?php echo $captcha_js; // 캡챠 사용시 자바스크립트에서 입력된 캡챠를 검사함  ?>
        document.getElementById("btn_submit").disabled = "disabled";
        return true;
    }
    </script>
</section>
<!-- } 게시물 작성/수정 끝 -->
 

 

배송지주소록 파일을 새로만들어서 하고있습니다 따로 손댄건 많이 없구요

orderaddress2.php


<?php
include_once('./_common.php');
if(!$is_member)
    alert_close('회원이시라면 회원로그인 후 이용해 주십시오.');
$ad_id = isset($_REQUEST['ad_id']) ? (int) $_REQUEST['ad_id'] : 0;
if($w == 'd') {
    $sql = " delete from {$g5['g5_shop_order_address_table']} where mb_id = '{$member['mb_id']}' and ad_id = '$ad_id' ";
    sql_query($sql);
    goto_url($_SERVER['SCRIPT_NAME']);
}
$sql_common = " from {$g5['g5_shop_order_address_table']} where mb_id = '{$member['mb_id']}' ";
$sql = " select count(ad_id) as cnt " . $sql_common;
$row = sql_fetch($sql);
$total_count = $row['cnt'];
$rows = $config['cf_page_rows'];
$total_page  = ceil($total_count / $rows);  // 전체 페이지 계산
if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$sql = " select *
            $sql_common
            order by ad_default desc, ad_id desc
            limit $from_record, $rows";
$result = sql_query($sql);
if(!sql_num_rows($result))
    alert_close('배송지 목록 자료가 없습니다.');
$order_action_url = G5_HTTPS_SHOP_URL.'/orderaddressupdate.php';
if (G5_IS_MOBILE) {
    include_once(G5_MSHOP_PATH.'/orderaddress.php');
    return;
}
// 테마에 orderaddress.php 있으면 include
if(defined('G5_THEME_SHOP_PATH')) {
    $theme_orderaddress_file = G5_THEME_SHOP_PATH.'/orderaddress.php';
    if(is_file($theme_orderaddress_file)) {
        include_once($theme_orderaddress_file);
        return;
        unset($theme_orderaddress_file);
    }
}
$g5['title'] = '배송지 목록';
include_once(G5_PATH.'/head.sub.php');
?>
<form name="forderaddress" method="post" action="<?php echo $order_action_url; ?>" autocomplete="off">
<div id="sod_addr" class="new_win">
    <h1 id="win_title">배송지 목록</h1>
    <div class="tbl_head03 tbl_wrap">
        <table>
        <thead>
        <tr>
            <th scope="col">배송지명</th>
            <th scope="col">이름</th>
            <th scope="col">배송지정보</th>
            <th scope="col">관리</th>
        </tr>
        </thead>
        <tbody>
        <?php
        $sep = chr(30);
        for($i=0; $row=sql_fetch_array($result); $i++) {
            $addr = $row['ad_name'].$sep.$row['ad_tel'].$sep.$row['ad_hp'].$sep.$row['ad_zip1'].$sep.$row['ad_zip2'].$sep.$row['ad_addr1'].$sep.$row['ad_addr2'].$sep.$row['ad_addr3'].$sep.$row['ad_jibeon'].$sep.$row['ad_subject'];
            $addr = get_text($addr);
        ?>
        <tr>
            <td class="td_sbj">
                <div class="chk_box">
                    <input type="hidden" name="ad_id[<?php echo $i; ?>]" value="<?php echo $row['ad_id'];?>">
                    <input type="checkbox" name="chk[]" value="<?php echo $i;?>" id="chk_<?php echo $i;?>" class="selec_chk">
                    <label for="chk_<?php echo $i;?>"><span></span><b class="sound_only">배송지선택</b></label>
                </div>
                <label for="ad_subject<?php echo $i;?>" class="sound_only">배송지명</label>
                <input type="text" name="ad_subject[<?php echo $i; ?>]" id="ad_subject<?php echo $i;?>" class="frm_input" size="12" maxlength="20" value="<?php echo get_text($row['ad_subject']); ?>">
            </td>
            <td class="td_name"><?php echo get_text($row['ad_name']); ?></td>
            <td class="td_address">
                <?php echo print_address($row['ad_addr1'], $row['ad_addr2'], $row['ad_addr3'], $row['ad_jibeon']); ?><br>
                <span class="ad_tel"><?php echo $row['ad_tel']; ?> / <?php echo $row['ad_hp']; ?></span>
            </td>
            <td class="td_mng">
                <input type="hidden" value="<?php echo $addr; ?>" >
                <button type="button" class="sel_address mng_btn">선택</button>
                <a href="<?php echo $_SERVER['SCRIPT_NAME']; ?>?w=d&ad_id=<?php echo $row['ad_id']; ?>" class="del_address mng_btn">삭제</a>
                <input type="radio" name="ad_default" value="<?php echo $row['ad_id'];?>" id="ad_default<?php echo $i;?>" <?php if($row['ad_default']) echo 'checked="checked"';?>>
                <label for="ad_default<?php echo $i;?>" class="default_lb mng_btn">기본배송지</label>
            </td>
        </tr>
        <?php
        }
        ?>
        </tbody>
        </table>
    </div>
    <div class="win_btn">
        <input type="submit" name="act_button" value="선택수정" class="btn_submit">
        <button type="button" onclick="self.close();" class="btn_close">닫기</button>
    </div>
</div>
</form>
<?php echo get_paging($config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&page="); ?>
<script>
$(function() {

    $(".sel_address").on("click", function() {
        var addr = $(this).siblings("input").val().split(String.fromCharCode(30));
/*
        var f = window.opener.forderform;
        f.od_b_name.value        = addr[0];
        f.od_b_tel.value         = addr[1];
        f.od_b_hp.value          = addr[2];
        f.od_b_zip.value         = addr[3] + addr[4];
        f.od_b_addr1.value       = addr[5];
        f.od_b_addr2.value       = addr[6];
        f.od_b_addr3.value       = addr[7];
        f.od_b_addr_jibeon.value = addr[8];
        f.ad_subject.value       = addr[9];
*/
        var f = window.opener.fwrite;
        f.wr_name.value        = addr[0];
        //f.od_b_tel.value       = addr[1];
        //f.od_b_hp.value        = addr[2];
        f.ex_zip.value         = addr[3] + addr[4];
        f.ex_addr1.value       = addr[5];
        f.ex_addr2.value       = addr[6];
        f.ex_addr3.value       = addr[7];
        f.ex_jibeon.value      = addr[8];
        f.wr_subject.value     = addr[9];
        //var hp  = addr[2].replace(/[^0-9]/g, "");
        //f.wr_2.value  = addr[2].substr(hp, 4, 4);
        //f.wr_3.value  = addr[2].substr(hp, 9, 4);
        var zip1 = addr[3].replace(/[^0-9]/g, "");
        var zip2 = addr[4].replace(/[^0-9]/g, "");
        if(zip1 != "" && zip2 != "") {
            var code = String(zip1) + String(zip2);
            if(window.opener.zipcode != code) {
                window.opener.zipcode = code;
                //window.opener.calculate_sendcost(code);
            }
        }
        window.close();
    });
    $(".del_address").on("click", function() {
        return confirm("배송지 목록을 삭제하시겠습니까?");
    });
    // 전체선택 부분
    $("#chk_all").on("click", function() {
        if($(this).is(":checked")) {
            $("input[name^='chk[']").attr("checked", true);
        } else {
            $("input[name^='chk[']").attr("checked", false);
        }
    });
    $(".btn_submit").on("click", function() {
        if($("input[name^='chk[']:checked").length==0 ){
            alert("수정하실 항목을 하나 이상 선택하세요.");
            return false;
        }
    });
});
</script>
<?php
include_once(G5_PATH.'/tail.sub.php');
 

 

데이터 넘길때 어떤걸 잘못했을까요? ㅠㅠ

이 질문에 댓글 쓰기 :

답변 3

phpmyadmind 등으로 해당 컬럼에 값이 들어 갔는지 확인해 보세요.

$sql2 = " insert into {$g5['g5_shop_order_address_table']}   set
                mb_id       = '{$member['mb_id']}',
...
                ad_addr2    = '$ex_addr2',
                ad_addr3    = '$ex_addr3',
                ad_jibeon   = '$ex_jibeon'  ";
sql_query($sql2, true); exit; // 이렇게 해서 오류가 있는지 살펴 보세요.

제가 알고 있기로는 주소에 대한 변수가 2종류가 있는것으로....

 

주문자주소와 배송지주소 두가지가 모두 업데이트되는지 확인해보시면 될것 같습니다.

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

회원로그인

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