라디오 버튼으로 선택가능한 검색 구현 질문입니다. 정보
라디오 버튼으로 선택가능한 검색 구현 질문입니다.본문
우선 소스는 아래와 같습니다.
<script language="javascript">
function show1(target){
target.style.display='';
m2.style.display='none';
}
function show2(target){
target.style.display='';
m1.style.display='none';
}
</script>
<script language="javascript">
<!--
function view(what) {
var imgwin = window.open("",'WIN','scrollbars=no,status=no,toolbar=no,resizable=no,location=no,menu=no,width=10,height=10');
imgwin.focus();
imgwin.document.open();
imgwin.document.write("<html>\n");
imgwin.document.write("<head>\n");
imgwin.document.write("<title>그림을 클릭하시면 창이 닫힙니다..</title>\n"); //오픈창 타이틀 이름 지정하는 부분
function show1(target){
target.style.display='';
m2.style.display='none';
}
function show2(target){
target.style.display='';
m1.style.display='none';
}
</script>
<script language="javascript">
<!--
function view(what) {
var imgwin = window.open("",'WIN','scrollbars=no,status=no,toolbar=no,resizable=no,location=no,menu=no,width=10,height=10');
imgwin.focus();
imgwin.document.open();
imgwin.document.write("<html>\n");
imgwin.document.write("<head>\n");
imgwin.document.write("<title>그림을 클릭하시면 창이 닫힙니다..</title>\n"); //오픈창 타이틀 이름 지정하는 부분
imgwin.document.write("<sc"+"ript>\n");
imgwin.document.write("function resize() {\n");
imgwin.document.write("pic = document.il;\n");
//imgwin.document.write("alert(eval(pic).height);\n");
imgwin.document.write("if (eval(pic).height) { var name = navigator.appName\n");
imgwin.document.write(" if (name == 'Microsoft Internet Explorer') { myHeight = eval(pic).height +20; myWidth = eval(pic).width + 0;\n");
imgwin.document.write(" } else { myHeight = eval(pic).height + 9; myWidth = eval(pic).width; }\n");
imgwin.document.write(" clearTimeout();\n");
imgwin.document.write(" var height = screen.height;\n");
imgwin.document.write(" var width = screen.width;\n");
imgwin.document.write(" var leftpos = width / 2 - myWidth / 2;\n");
imgwin.document.write(" var toppos = height / 2 - myHeight / 2; \n");
imgwin.document.write(" self.moveTo(leftpos, toppos);\n");
imgwin.document.write(" self.resizeTo(myWidth, myHeight);\n");
imgwin.document.write("}else setTimeOut(resize(), 100);}\n");
imgwin.document.write("</sc"+"ript>\n");
imgwin.document.write("function resize() {\n");
imgwin.document.write("pic = document.il;\n");
//imgwin.document.write("alert(eval(pic).height);\n");
imgwin.document.write("if (eval(pic).height) { var name = navigator.appName\n");
imgwin.document.write(" if (name == 'Microsoft Internet Explorer') { myHeight = eval(pic).height +20; myWidth = eval(pic).width + 0;\n");
imgwin.document.write(" } else { myHeight = eval(pic).height + 9; myWidth = eval(pic).width; }\n");
imgwin.document.write(" clearTimeout();\n");
imgwin.document.write(" var height = screen.height;\n");
imgwin.document.write(" var width = screen.width;\n");
imgwin.document.write(" var leftpos = width / 2 - myWidth / 2;\n");
imgwin.document.write(" var toppos = height / 2 - myHeight / 2; \n");
imgwin.document.write(" self.moveTo(leftpos, toppos);\n");
imgwin.document.write(" self.resizeTo(myWidth, myHeight);\n");
imgwin.document.write("}else setTimeOut(resize(), 100);}\n");
imgwin.document.write("</sc"+"ript>\n");
imgwin.document.write("</head>\n");
imgwin.document.write('<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" bgcolor="black">\n');
imgwin.document.write('<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" bgcolor="black">\n');
imgwin.document.write("<img border=0 src="+what+" xwidth=100 xheight=9 name=il onload='resize();' onclick='window.close();' style='cursor:pointer'>\n");
imgwin.document.write("</body>\n");
imgwin.document.close();
}
-->
</script>
<!-- 게시판 목록 시작 -->
<table width="<?=$width?>" align=center cellpadding=0 cellspacing=0>
<tr>
<td>
<table width="100%" border="0">
<tr><td bgcolor="ffd3b0" align="center"><?
$cnt = 1;
$sql = " SELECT bo_category_list FROM $g4[board_table] WHERE bo_table='$bo_table' ";
$row = sql_fetch($sql);
$arr = explode("|", $row[bo_category_list]); // 구분자가 , 로 되어 있음
$str = "";
$str .= "";
for ($i=0; $i<count($arr); $i++)
if (trim($arr[$i])) {
$sql1 = " SELECT count(*) as cCount FROM $write_table WHERE ca_name='$arr[$i]' and wr_comment >=0 ";
$row1 = sql_fetch($sql1);
$str .= "<a href='./board.php?bo_table=$bo_table&page=$page&mode=$mode&sca=$arr[$i]'>$arr[$i] ($row1[cCount])명</a> ";
if ($cnt%$board[bo_7] == 0) {
$cnt = 0; $str .= "<br>";
}
$cnt++;
}
$sql2 = " SELECT count(*) as cCount FROM $write_table WHERE wr_comment >= 0 ";
$row2 = sql_fetch($sql2);
$Total_Cat = $row2[cCount]
?>
<b><?=$board[bo_4]?></b><a href='./board.php?bo_table=<?=$bo_table?>&page=<?=$page?>&mode=subject'><b><font color="000000">전체 :<?=$Total_Cat?>명</font></a><br><br><?=$str?></b>
</td>
<td bgcolor="c9c9c9">
<form name=fsearch method=get style="margin:0px;">
<input type=hidden name=bo_table value="<?=$bo_table?>">
<input type=hidden name=sca value="<?=$sca?>">
<br>
<p align="left">
<input type="radio" name="service" onclick="show1(m1)" checked>임의로 조회
<input type="radio" name="service" onclick="show2(m2)">본인의 친밀도 조회</p>
imgwin.document.write("</body>\n");
imgwin.document.close();
}
-->
</script>
<!-- 게시판 목록 시작 -->
<table width="<?=$width?>" align=center cellpadding=0 cellspacing=0>
<tr>
<td>
<table width="100%" border="0">
<tr><td bgcolor="ffd3b0" align="center"><?
$cnt = 1;
$sql = " SELECT bo_category_list FROM $g4[board_table] WHERE bo_table='$bo_table' ";
$row = sql_fetch($sql);
$arr = explode("|", $row[bo_category_list]); // 구분자가 , 로 되어 있음
$str = "";
$str .= "";
for ($i=0; $i<count($arr); $i++)
if (trim($arr[$i])) {
$sql1 = " SELECT count(*) as cCount FROM $write_table WHERE ca_name='$arr[$i]' and wr_comment >=0 ";
$row1 = sql_fetch($sql1);
$str .= "<a href='./board.php?bo_table=$bo_table&page=$page&mode=$mode&sca=$arr[$i]'>$arr[$i] ($row1[cCount])명</a> ";
if ($cnt%$board[bo_7] == 0) {
$cnt = 0; $str .= "<br>";
}
$cnt++;
}
$sql2 = " SELECT count(*) as cCount FROM $write_table WHERE wr_comment >= 0 ";
$row2 = sql_fetch($sql2);
$Total_Cat = $row2[cCount]
?>
<b><?=$board[bo_4]?></b><a href='./board.php?bo_table=<?=$bo_table?>&page=<?=$page?>&mode=subject'><b><font color="000000">전체 :<?=$Total_Cat?>명</font></a><br><br><?=$str?></b>
</td>
<td bgcolor="c9c9c9">
<form name=fsearch method=get style="margin:0px;">
<input type=hidden name=bo_table value="<?=$bo_table?>">
<input type=hidden name=sca value="<?=$sca?>">
<br>
<p align="left">
<input type="radio" name="service" onclick="show1(m1)" checked>임의로 조회
<input type="radio" name="service" onclick="show2(m2)">본인의 친밀도 조회</p>
<div id='m1' style=display='show'>
<select name=sfl>
<option value='wr_subject||wr_1||wr_5||wr_content'>전체조건</option>
<option value='wr_subject'>검색조건1</option>
<option value='wr_1'>검색조건2</option>
<option value='wr_5'>검색조건3</option>
<option value='wr_content'>검색조건4</option>
</select>
<input name=stx maxlength=15 size=10 itemname="검색어" value="<?=$stx?>">
</div>
<select name=sfl>
<option value='wr_subject||wr_1||wr_5||wr_content'>전체조건</option>
<option value='wr_subject'>검색조건1</option>
<option value='wr_1'>검색조건2</option>
<option value='wr_5'>검색조건3</option>
<option value='wr_content'>검색조건4</option>
</select>
<input name=stx maxlength=15 size=10 itemname="검색어" value="<?=$stx?>">
</div>
<div id='m2' style=display='none'>
<li> 검색조건 <select name=sfl>
<option value='wr_content'>본인의 친밀도 조회</option>
</select><font color="ff7200"> <b>※검색조건을 선택후 검색어를 입력 히시기 바랍니다.</b></font><br>
<li> 본인과의 친밀도
<select name=stx>
<option value=''>친밀도를 선택하세요.</option>
<option value='<? echo $member[mb_name]; ?>a'>본인과의 친밀도 A</option>
<option value='<? echo $member[mb_name]; ?>b'>본인과의 친밀도 B</option>
<option value='<? echo $member[mb_name]; ?>c'>본인과의 친밀도 C</option>
</select><br> </div>
<br>
<input type=image src="<?=$board_skin_path?>/img/search_btn.gif" border=0 align=absmiddle><br></font></p>
<li> 검색조건 <select name=sfl>
<option value='wr_content'>본인의 친밀도 조회</option>
</select><font color="ff7200"> <b>※검색조건을 선택후 검색어를 입력 히시기 바랍니다.</b></font><br>
<li> 본인과의 친밀도
<select name=stx>
<option value=''>친밀도를 선택하세요.</option>
<option value='<? echo $member[mb_name]; ?>a'>본인과의 친밀도 A</option>
<option value='<? echo $member[mb_name]; ?>b'>본인과의 친밀도 B</option>
<option value='<? echo $member[mb_name]; ?>c'>본인과의 친밀도 C</option>
</select><br> </div>
<br>
<input type=image src="<?=$board_skin_path?>/img/search_btn.gif" border=0 align=absmiddle><br></font></p>
실제 검색기능과 관련이 있는부분 소스는
<script language="javascript">
function show1(target){
target.style.display='';
m2.style.display='none';
}
function show2(target){
target.style.display='';
m1.style.display='none';
}
</script>
function show1(target){
target.style.display='';
m2.style.display='none';
}
function show2(target){
target.style.display='';
m1.style.display='none';
}
</script>
중간생략...
<form name=fsearch method=get style="margin:0px;">
<input type=hidden name=bo_table value="<?=$bo_table?>">
<input type=hidden name=sca value="<?=$sca?>">
<br>
<p align="left">
<input type="radio" name="service" onclick="show1(m1)" checked>임의로 조회
<input type="radio" name="service" onclick="show2(m2)">본인의 친밀도 조회</p>
<input type=hidden name=bo_table value="<?=$bo_table?>">
<input type=hidden name=sca value="<?=$sca?>">
<br>
<p align="left">
<input type="radio" name="service" onclick="show1(m1)" checked>임의로 조회
<input type="radio" name="service" onclick="show2(m2)">본인의 친밀도 조회</p>
<div id='m1' style=display='show'>
<select name=sfl>
<option value='wr_subject||wr_1||wr_5||wr_content'>전체조건</option>
<option value='wr_subject'>검색조건1</option>
<option value='wr_1'>검색조건2</option>
<option value='wr_5'>검색조건3</option>
<option value='wr_content'>검색조건4</option>
</select>
<input name=stx maxlength=15 size=10 itemname="검색어" value="<?=$stx?>">
</div>
<select name=sfl>
<option value='wr_subject||wr_1||wr_5||wr_content'>전체조건</option>
<option value='wr_subject'>검색조건1</option>
<option value='wr_1'>검색조건2</option>
<option value='wr_5'>검색조건3</option>
<option value='wr_content'>검색조건4</option>
</select>
<input name=stx maxlength=15 size=10 itemname="검색어" value="<?=$stx?>">
</div>
<div id='m2' style=display='none'>
<li> 검색조건 <select name=sfl>
<option value='wr_content'>본인의 친밀도 조회</option>
</select><font color="ff7200"> <b>※검색조건을 선택후 검색어를 입력 히시기 바랍니다.</b></font><br>
<li> 본인과의 친밀도
<select name=stx>
<option value=''>친밀도를 선택하세요.</option>
<option value='<? echo $member[mb_name]; ?>a'>본인과의 친밀도 A</option>
<option value='<? echo $member[mb_name]; ?>b'>본인과의 친밀도 B</option>
<option value='<? echo $member[mb_name]; ?>c'>본인과의 친밀도 C</option>
</select><br> </div>
<br>
<input type=image src="<?=$board_skin_path?>/img/search_btn.gif" border=0 align=absmiddle>
<li> 검색조건 <select name=sfl>
<option value='wr_content'>본인의 친밀도 조회</option>
</select><font color="ff7200"> <b>※검색조건을 선택후 검색어를 입력 히시기 바랍니다.</b></font><br>
<li> 본인과의 친밀도
<select name=stx>
<option value=''>친밀도를 선택하세요.</option>
<option value='<? echo $member[mb_name]; ?>a'>본인과의 친밀도 A</option>
<option value='<? echo $member[mb_name]; ?>b'>본인과의 친밀도 B</option>
<option value='<? echo $member[mb_name]; ?>c'>본인과의 친밀도 C</option>
</select><br> </div>
<br>
<input type=image src="<?=$board_skin_path?>/img/search_btn.gif" border=0 align=absmiddle>
이 부분입니다만..
두번째를 선택하여 검색하면 잘 됩니다..
그런데 첫번째
<div id='m1' style=display='show'>
<select name=sfl>
<option value='wr_subject||wr_1||wr_5||wr_content'>전체조건</option>
<option value='wr_subject'>검색조건1</option>
<option value='wr_1'>검색조건2</option>
<option value='wr_5'>검색조건3</option>
<option value='wr_content'>검색조건4</option>
</select>
<input name=stx maxlength=15 size=10 itemname="검색어" value="<?=$stx?>">
</div>
<select name=sfl>
<option value='wr_subject||wr_1||wr_5||wr_content'>전체조건</option>
<option value='wr_subject'>검색조건1</option>
<option value='wr_1'>검색조건2</option>
<option value='wr_5'>검색조건3</option>
<option value='wr_content'>검색조건4</option>
</select>
<input name=stx maxlength=15 size=10 itemname="검색어" value="<?=$stx?>">
</div>
이부분이 검색이 잘 안되서 질문드립니다..
스크립트를 제거하고 div를 제거하고 기본검색 형태로 검색하면 잘되는데..
실력이 모자라 이부분을 해결을 못하고...낑낑 헤매고 있습니다..
고수님들의 조언을 구합니다......
댓글 전체
<form> 과 검색버튼을 <div> 마다 넣어주시고,
form name 을 서로 다르게 구분해주세요...^^
입력검사도 물론 서로 다르게 ~~
form name 을 서로 다르게 구분해주세요...^^
입력검사도 물론 서로 다르게 ~~
PhotoFly님//
감사 합니다...^^
감사 합니다...^^