[php] 2단 셀렉트 연동 > 팁앤테크

본문 바로가기
사이트 내 전체검색

팁앤테크

[php] 2단 셀렉트 연동

페이지 정보

본문

<script language="javascript">
window.onload = function() {
    document.getElementById("wr2_7").onchange = function() { getClass(this.form.wr2_7.options.selectedIndex) };
}

var classG = new Array(
    new Array("##선택##")
    <?php
    $sql = " select *
                from {$g5['menu_table']}
                where me_use = '1'
                  and length(me_code) = '2'
                order by me_order, me_id ";
    $result = sql_query($sql, false);

    for ($i=0; $row=sql_fetch_array($result); $i++) {
    ?>,new Array(
        <?php
        $sql2 = " select *
                    from {$g5['menu_table']}
                    where me_use = '1'
                      and length(me_code) = '4'
                      and substring(me_code, 1, 2) = '{$row['me_code']}'
                    order by me_order, me_id ";
        $result2 = sql_query($sql2);

        for ($k=0; $row2=sql_fetch_array($result2); $k++) {
            if($k==0) {
        ?>
            "<?php echo $row2[me_name]?>"
        <?php } else { ?>
            ,"<?php echo $row2[me_name]?>"
        <?php } ?>
        <?php
        }
        ?>)
    <?php } ?>
);

var temp, i=0, j=0;
var cselect;

function getClass(item) {
temp = document.getElementById("wr2_8");
subCnt = temp.options.length;
    for (i=(subCnt-1); i>0; i--) { temp.options[i] = null }
        for (var j=0; j<classG[item].length; j++) {
            cselect = classG[item][j];
            temp.options[j] = new Option(cselect, cselect)
        }
}

</script>


    <select name="wr2[7]" id="wr2_7">
        <option value="">선택해 주세요</option>
        <?php
        $sql = " select *
                    from {$g5['menu_table']}
                    where me_use = '1'
                      and length(me_code) = '2'
                    order by me_order, me_id ";
        $result = sql_query($sql, false);
   
        for ($i=0; $row=sql_fetch_array($result); $i++) {
        ?>
        <option value="<?php echo $row['me_name'] ?>"><?php echo $row['me_name'] ?></option>
        <?php } ?>
    </select>
    <select name="wr2[8]" id="wr2_8">
        <option value="">선택해 주세요</option>
    </select>
추천0

댓글목록

등록된 댓글이 없습니다.

Total 124건 5 페이지
  • RSS
팁앤테크 목록
번호 제목 글쓴이 조회 추천 날짜
24 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 15129 0 09-29
23 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 15272 0 09-01
22 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 18109 0 08-12
21 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 17070 0 06-23
20 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 16248 0 06-19
19 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 20371 0 06-03
18 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 18049 0 06-01
17 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 16301 0 06-01
16 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 13819 0 05-26
15 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 16275 0 05-22
14 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 18107 0 05-21
13 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 13651 0 03-18
12 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 15027 0 02-28
11 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 19987 0 02-14
10 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 22938 0 01-23
9 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 17247 0 01-19
8 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 13576 0 01-07
7 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 17962 0 12-13
6 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 15071 0 12-10
5 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 23374 0 12-02
4 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 18702 0 11-29
3 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 22800 0 10-10
2 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 16485 0 06-24
1 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 18984 0 05-31

검색

회원로그인

회원가입

사이트 정보

株式会社YHPLUS / 대표 : ZERO
〒140-0011 東京都品川区東大井2-5-9-203
050-5539-7787
오픈카카오톡 (YHPLUS) :
https://open.kakao.com/o/slfDj15d

접속자집계

오늘
5,311
어제
7,612
최대
8,233
전체
1,622,496
Copyright (c) 株式会社YHPLUS. All rights reserved.