전체검색창을 제목 혹은 내용버튼오로만 정렬이 될까요

전체검색창을 제목 혹은 내용버튼오로만 정렬이 될까요

QA

전체검색창을 제목 혹은 내용버튼오로만 정렬이 될까요

답변 1

본문

모바일때문에 고민하다가 무식한 방법으로 하는데..

초보이다보니..모르는게 태반이라 혹시나 하고 여쭤봅니다

 

모바일에서 전체검색창을 아에 박아놨어요 ( 검색을 자주 쓰는 입장이라 )

 

그런데 이제 전체검색 페이지를 쓰게되면

search.skin.php에 또 검색창이 나옵니다

아래처럼요..

 

2072820919_1685865318.977.png

 

 

검색창이 중복되는게 좀 그렇고..디테일한 검색까지는 필요없어서..

제목 과 내용 두가지로만 버튼으로만 넣고 싶었어요

(모바일이라 화면도 좁고해서..)

 

처음검색에서는 전체검색으로 나오고

 

2072820919_1685865868.75.png

 

 

위 그림처럼 버튼으로만 하고싶었죠...

제목버튼 누르면 제목으로만 정렬~

내용버튼을 누르면 내용으로만 정렬~

그런데 도저히 방법을 모르겠는거에요

 

그래서..그냥 에라이 미친척하고..폼을 두개를 깔아버리고

요소는 style="display:none"로 감춘다음에

 

내용만 제목만 이런 글자만 노출되게 했어요..

누르니깐 전체검색된부분에서

다시 제목만이라던지...내용만이라던지...뭐..실행은 잘되고 있어요..

 

폼이 두개 들어가는것도 그렇고..

이런식으로 하는건 아닌거 같은데..

근데 혹시 좀 세련된 방법이나..제대로된방법이 있다면 조언좀 부탁드립니다

 


<form class="form" role="form" name="fsearch" onsubmit="return fsearch_submit(this);"method="get">
    <input type="hidden" name="srows" value="<?php echo $srows ?>">
        <div class="row">
            <div style="display:none">            
                    <select name="sfl" id="sfl" class="form-control input-sm">            
                        <option value="wr_subject"<?php echo get_selected($_GET['sfl'], "wr_subject") ?>>제목</option>                        
                    </select>    
            </div>
            <div style="display:none">                    
                <input type="text" name="stx" value="<?php echo $text_stx ?>" id="stx" required class="form-control input-sm" maxlength="20" placeholder="두글자 이상 입력">
            </div>
            <div>
                    <button type="submit"> 제목만</button>
            </div>
        </div>
</form>
 
###########################################################
 
<form class="form" role="form" name="fsearch" onsubmit="return fsearch_submit(this);"method="get">
    <input type="hidden" name="srows" value="<?php echo $srows ?>">
        <div class="row">
            <div style="display:none">            
                    <select name="sfl" id="sfl" class="form-control input-sm">            
                        <option value="wr_content"<?php echo get_selected($_GET['sfl'], "wr_content") ?>>내용</option>                    
                    </select>    
            </div>
            <div style="display:none">                    
                <input type="text" name="stx" value="<?php echo $text_stx ?>" id="stx" required class="form-control input-sm" maxlength="20" placeholder="두글자 이상 입력">
            </div>
            <div>
                    <button type="submit"> 내용만</button>
            </div>
        </div>
</form>

 

2072820919_1685866091.0543.jpg

 

ㅜㅜ

이 질문에 댓글 쓰기 :

답변 1

아래 처럼 처리하시면 됩니다


<script type="text/javascript">
<!--
function btn_sch(sfl){
    location.href="?srows=<?=$srows?>&sfl="+sfl+"&stx=<?php echo $text_stx ?>";
}
//-->
</script>
<div>
    <button type="button" onclick="btn_sch('wr_subject')"> 제목만</button>
    <button type="button" onclick="btn_sch('wr_content')"> 내용만</button>
</div>
답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 125,873
© SIRSOFT
현재 페이지 제일 처음으로