묻고답하기

이 소스는 인터넷을 돌아다니다가 발견한 소스입니다. 

일단 PHP와 DB 연동에 대해서는 왕초보라고 생각하시면 될듯 합니다. 

 

이 소스를 이용하여 검색 단추를 어디다가 추가를 해야되는지.. 

그리고 시작일과 종료일을 DB 연동을 시켜야하는데. 

FORM ACTION 이라는것도 없어서 어떻게 넘겨줘야되며,(PHP확장자) 

PHP에서 시작일과 종료일을 변수로 넘겨야되는지.. 아니면.. PHP DB를 연동해야되는지 모르겠습니다. 

 

알려주시면 정말로 감사하겠습니다. ㅠ 

 

원소스 

------------------------------------------------------------------------------------ 

<!DOCTYPE html> 

<html> 

    <head> 

        <meta charset="UTF-8" /> 

        <title>jQuery UI</title> 

        <link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"/> 

 

        <style>    

        

            /* Default */ 

            input[type=text],input[type=password]{font-family:"Malgun Gothic","맑은 고딕",Dotum,"돋움",Arial,sans-serif} 

            *{margin:0;padding:0;font-family:"Malgun Gothic","맑은 고딕",Dotum,"돋움",Arial,sans-serif} 

            body{font-size:12px;color:#555;background:transparent;-webkit-user-select:none;-moz-user-select:none;-webkit-text-size-adjust:none;-moz-text-size-adjust:none;-ms-text-size-adjust:none} 

            ol,ul{list-style:none} 

            table{table-layout:fixed;width:100%;border-collapse:collapse;border-spacing:0} 

            caption{overflow:hidden;width:0;height:0;font-size:0;line-height:0;text-indent:-999em} 

            img,fieldset{border:0} 

            legend{height:0;visibility:hidden} 

            em,address{font-style:normal} 

            img{border:0 none;vertical-align:middle} 

            a{color:#555;text-decoration:none} 

            input,select{margin:0;padding:0;vertical-align:middle} 

            button{margin:0;padding:0;font-family:inherit;border:0 none;background:transparent;cursor:pointer} 

            button::-moz-focus-inner{border:0;padding:0} 

            header,footer,aside,nav,section,article{display:block} 

 

            .clearfix{*zoom:1} 

            .clearfix:after{content:"";display:block;clear:both;overflow:hidden} 

 

            /* Search */ 

            .searchBox{border:none} 

            .searchBox tbody th{padding:20px 10px 20px 35px;font-size:14px;font-weight:bold;text-align:left;vertical-align:top;border:none;background:#e6e6e6 } 

            .searchBox tbody td{padding:12px 10px 12px 25px;border:none;background-color:#efefef} 

        

            .searchDate{overflow:hidden;margin-bottom:10px;*zoom:1} 

            .searchDate:after{display:block;clear:both;content:''} 

            .searchDate li{position:relative;float:left;margin:0 7px 0 0} 

            .searchDate li .chkbox2{display:block;text-align:center} 

            .searchDate li .chkbox2 input{position:absolute;z-index:-1} 

            .searchDate li .chkbox2 label{display:block;width:72px;height:26px;font-size:14px;font-weight:bold;color:#fff;text-align:center;line-height:25px;text-decoration:none;cursor:pointer;background:#a5b0b6} 

            .searchDate li .chkbox2.on label{background:#ec6a6a} 

        

            .demi{display:inline-block;margin:0 1px;vertical-align:middle} 

            .inpType{padding-left:6px;height:24px;line-height:24px;border:1px solid #dbdbdb} 

            .btncalendar{display:inline-block;width:22px;height:22px;background:url(images/btn_calendar.gif) center center no-repeat;text-indent:-999em} 

 

 

        </style> 

 

        <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> 

        <script src="http://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script> 

        <!-- datepicker 한국어로 --> 

        <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/i18n/datepicker-ko.js"></script> 

    

        <script>                

 

        $(document).ready(function() { 

 

            //datepicker 한국어로 사용하기 위한 언어설정 

            $.datepicker.setDefaults($.datepicker.regional['ko']);    

        

            // Datepicker            

            $(".datepicker").datepicker({ 

                showButtonPanel: true, 

                dateFormat: "yy-mm-dd", 

                onClose : function ( selectedDate ) { 

                

                    var eleId = $(this).attr("id"); 

                    var optionName = ""; 

 

                    if(eleId.indexOf("StartDate") > 0) { 

                        eleId = eleId.replace("StartDate", "EndDate"); 

                        optionName = "minDate"; 

                    } else { 

                        eleId = eleId.replace("EndDate", "StartDate"); 

                        optionName = "maxDate"; 

                    } 

 

                    $("#"+eleId).datepicker( "option", optionName, selectedDate );        

                    $(".searchDate").find(".chkbox2").removeClass("on"); 

                } 

            }); 

 

            //시작일. 

            /*$('#searchStartDate').datepicker("option","onClose", function( selectedDate ) {    

                // 시작일 datepicker가 닫힐때 

                // 종료일의 선택할수있는 최소 날짜(minDate)를 선택한 시작일로 지정 

                $("#searchEndDate").datepicker( "option", "minDate", selectedDate ); 

                $(".searchDate").find(".chkbox2").removeClass("on"); 

            }); 

            */ 

 

            //종료일. 

            /*$('#searchEndDate').datepicker("option","onClose", function( selectedDate ) {    

                // 종료일 datepicker가 닫힐때 

                // 시작일의 선택할수있는 최대 날짜(maxDate)를 선택한 종료일로 지정 

                $("#searchStartDate").datepicker( "option", "maxDate", selectedDate ); 

                $(".searchDate").find(".chkbox2").removeClass("on"); 

            }); 

            */ 

 

            $(".dateclick").dateclick();    // DateClick 

            $(".searchDate").schDate();        // searchDate 

            

        }); 

 

        // Search Date 

        jQuery.fn.schDate = function(){ 

            var $aaa = $(this); 

            var $chk = $aaa.find("input[type=radio]"); 

            $chk.click(function(){                

                $('input:not(:checked)').parent(".chkbox2").removeClass("on"); 

                $('input:checked').parent(".chkbox2").addClass("on");                    

            }); 

        }; 

 

        // DateClick 

        jQuery.fn.dateclick = function(){ 

            var $aaa = $(this); 

            $aaa.click(function(){ 

                $(this).parent().find("input").focus(); 

            }); 

        }    

 

        

        function setSearchDate(start){ 

 

            var num = start.substring(0,1); 

            var str = start.substring(1,2); 

 

            var today = new Date(); 

 

            //var year = today.getFullYear(); 

            //var month = today.getMonth() + 1; 

            //var day = today.getDate(); 

            

            var endDate = $.datepicker.formatDate('yy-mm-dd', today); 

            $('#searchEndDate').val(endDate); 

            

            if(str == 'd'){ 

                today.setDate(today.getDate() - num); 

            }else if (str == 'w'){ 

                today.setDate(today.getDate() - (num*7)); 

            }else if (str == 'm'){ 

                today.setMonth(today.getMonth() - num); 

                today.setDate(today.getDate() + 1); 

            } 

 

            var startDate = $.datepicker.formatDate('yy-mm-dd', today); 

            $('#searchStartDate').val(startDate); 

                    

            // 종료일은 시작일 이전 날짜 선택하지 못하도록 비활성화 

            $("#searchEndDate").datepicker( "option", "minDate", startDate ); 

            

            // 시작일은 종료일 이후 날짜 선택하지 못하도록 비활성화 

            $("#searchStartDate").datepicker( "option", "maxDate", endDate ); 

 

        } 

 

            

        </script> 

 

    </head> 

    <body> 

 

        <form> 

            

        <!-- search --> 

        <table class="searchBox"> 

            <caption>조회</caption> 

            <colgroup> 

                <col width="123px"> 

                <col width="*"> 

            </colgroup> 

            <tbody> 

                <tr> 

                    <th>조회기간</th> 

                    <td> 

                        <ul class="searchDate"> 

                            <li> 

                                <span class="chkbox2"> 

                                    <input type="radio" name="dateType" id="dateType1" onclick="setSearchDate('0d')"/> 

                                    <label for="dateType1">당일</label> 

                                </span> 

                            </li> 

                            <li> 

                                <span class="chkbox2"> 

                                    <input type="radio" name="dateType" id="dateType2" onclick="setSearchDate('3d')"/> 

                                    <label for="dateType2">3일</label> 

                                </span> 

                            </li> 

                            <li> 

                                <span class="chkbox2"> 

                                    <input type="radio" name="dateType" id="dateType3" onclick="setSearchDate('1w')"/> 

                                    <label for="dateType3">1주</label> 

                                </span> 

                            </li> 

                            <li> 

                                <span class="chkbox2"> 

                                    <input type="radio" name="dateType" id="dateType4" onclick="setSearchDate('2w')"/> 

                                    <label for="dateType4">2주</label> 

                                </span> 

                            </li> 

                            <li> 

                                <span class="chkbox2"> 

                                    <input type="radio" name="dateType" id="dateType5" onclick="setSearchDate('1m')"/> 

                                    <label for="dateType5">1개월</label> 

                                </span> 

                            </li> 

                            <li> 

                                <span class="chkbox2"> 

                                    <input type="radio" name="dateType" id="dateType6" onclick="setSearchDate('3m')"/> 

                                    <label for="dateType6">3개월</label> 

                                </span> 

                            </li> 

                            <li> 

                                <span class="chkbox2"> 

                                    <input type="radio" name="dateType" id="dateType7" onclick="setSearchDate('6m')"/> 

                                    <label for="dateType7">6개월</label> 

                                </span> 

                            </li> 

                        </ul> 

                        

                        <div class="clearfix"> 

                            <!-- 시작일 --> 

                            <span class="dset"> 

                                <input type="text" class="datepicker inpType" name="searchStartDate" id="searchStartDate" > 

                                <a href="#none" class="btncalendar dateclick">달력</a> 

                            </span> 

                            <span class="demi">~</span> 

                            <!-- 종료일 --> 

                            <span class="dset"> 

                                <input type="text" class="datepicker inpType" name="searchEndDate" id="searchEndDate" > 

                                <a href="#none" class="btncalendar dateclick">달력</a> 

                            </span> 

                        </div>    

                    </td> 

                </tr> 

 

            <tbody> 

        </table> 

        </form> 

    </body> 

 

</html>

 
태그 연관 글
  1. [2016/02/06] 묻고답하기 외부페이지에서 Google Map jquery 에러 해결방법 문의 by tohappy *2
글쓴이 제목 최종 글
XE 공지 글 쓰기,삭제 운영방식 변경 공지 [16] 2019.03.05 by 남기남
좋은사람임 이 소스를 이용하여 db연동 하는 소스 문의 [1] 2018.08.14 by 디자인클립
boss777 설치오류 XE cannot connect to DB 조언 부탁 드립니다. 날샛어용.. [2] file 2018.06.18 by boss777
outsider 시놀로지 XE 설치시 DB 연결 실패 [4] file 2017.12.19 by 명이
deok 그누보드5 -> XE로 데이터(db)이전 [5] 2017.10.24 by 카이4525b
ljk**** 외부페이지에서 Ajax로 등록처리시 &DB 가 존재하지 않아요  
이진샘 db에서 data 불러오기 중에 문법 오류가 있나해서 조언을 구해봅니다. [3] 2016.05.21 by 이진샘
theaud**** 폴더안 txt 문서를 php explode 하여 mysql 에 넣는 과정이 안됩니다ㅠㅠ  
tohappy 외부페이지에서 Google Map jquery 에러 해결방법 문의 [2] 2016.03.03 by tohappy
hyotory 메뉴 #지정한 구간으로 이동문의 [2] 2016.02.01 by rwind
오뎅궁물 코어 1.8.3에서 변경된 CSS가 있나요? [5] 2015.11.18 by 오뎅궁물
gonom 대용량 테이블(테이터베이스, db, table) 처리 어떻게 하시나요? [6] 2015.11.02 by gonom
Paul [DB] xe_document_histories 라는 곳에 있는 것들을 지워도 되나요? [2] 2015.10.29 by Paul
love**** 메모리 풀 에러 메시지 해결 방법을 알려주세요. [4] file 2015.07.06 by love****
똘레랑스0145a 레이아웃 설치가 안됩니다.- Latest version: XE Core ver. 1.8.2 설치 [4] 2015.06.02 by 똘레랑스0145a
갤럭시s5 이거 뭔뜻인가요? [4] 2015.01.31 by 펭귄냠냠
비상9 [질문] innodb 와 myisam의 선택 [5] 2015.01.07 by 꾸링
비상9 모듈 개발시 "DB Table 생성을 해야 설치가 완료됩니다." [5] 2014.11.12 by 비상9
poltwo 게시글이동 쿼리질문입니다 [2] 2014.09.07 by poltwo
young3mom 도와주세요ㅠㅠ갑자기 관리자페이지랑 홈페이지가 안들어가지네요ㅠㅠ  
아막 호스팅 계정명 변경 후 접속문제..ㅠㅠ DB정보..? [2] 2014.04.28 by Double'U'