검색값을 남기고 다시 검색값을 붙게 하려면 뭘 해야되날까요?
본문
<form name="search" method="get">
<table summary="검색창" class="search_table">
<tr>
<th><label for="ship_no">주문 번호</label></th>
<td><input type="text" id="ship_no" name="ship_no" value="<?php echo $ship_no; ?>" class="frm_input" size="20">
</tr>
</table>
<div class="button_box">
<input type="submit" value="검색" class="btn_search">
</div>
</form>
<form name="shippinglist" id="shippinglist" action="<?php echo $nonShip_action_url ?>" onsubmit="return shippinglist_submit(this);" method="post">
<div class="ship_no_box"><h2>주문 번호</h2>
<div class="ship_no_input">
<input type="text" id="ship_no" name="ship_no" value="<?php echo $ship_no; ?>" class="frm_input" >
</div>
</div>
<input class="btn_ship_no" type="submit" name="act_button" value="수정">
<br>
<?php
$rownum=0;
$sql_main = " SELECT a.ship_no
FROM g5_ship_list a left outer join g5_member b on a.delivery_main_mb = b.mb_id
left outer join g5_member c on a.delivery_sub_mb = c.mb_id
where 1=1";
$sql_main_search = "";
if($ship_no)
{
if(substr_count($ship_no,',') == 0)
{
$sql_main_search .= " a.ship_no like '%{$ship_no}%' or";
}
else
{
$arrShipNo = split(",",$ship_no);
for ($a=0; $a<count($arrShipNo); $a++)
{
$sql_main_search .= " a.ship_no like '%{$arrShipNo[$a]}%' or";
}
}
}
$sqlCount = " select count(*) as cnt
FROM g5_ship_list a left outer join g5_member b on a.delivery_main_mb = b.mb_id
left outer join g5_member c on a.delivery_sub_mb = c.mb_id
where 1=1
{$sql_main_search} ";
$rowCount = sql_fetch($sqlCount);
$total_count = $rowCount['cnt'];
$sql = " {$sql_main} {$sql_main_search} order by a.ship_date desc , cast(substr(a.ship_no,7) AS signed ) desc ";?>
<br>
<div class="button_set">
<input class="btn_com" type="submit" name="act_button1" value="저장" >
</div>
<div class="all_count">
총 <?php echo $total_count ?> 건
</div>
<div id="shippinglist">
<table>
<thead>
<tr id="col_box">
<th scope="col" class="col_0"></th>
<th scope="col" id="chk">
<label for="chkall" class="sound_only"></label>
<input type="checkbox" name="checkAll" value="1" id="checkAll" >
</th>
<th scope="col" class="col_1">주문번호</th>
</tr>
</thead>
<tbody>
<?php
$arrChkShip = split(",",$chkShipValue);
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$rownum =$rownum+1;?>
<tr>
<td><?php echo $i+1 ?></td>
<td class="td_field_number"><a href="#" onclick="uploadPop('<?php echo $rownum ?>')"> <?php echo $row['ship_no'] ?></td>
</tr>
<?php }
if ($i == 0)
echo '<tr><td colspan="'.$colspan.'" class="empty_table">자료가 없습니다.</td></tr>';
?>
</tbody>
</table>
</div>
</form>
길어서 몇가지 생략하였는데
대략 위에 코드로 db를 검색해서
화면에 노출되게 하고 있습니다.
덧붙임 검색이 필요해서 검색값을 유지시키고
새로운 검색값이 밑에 따라붙게 하고 싶은데 어떻게 해야될까요?
고수님들 도움부탁드립니다...
!-->답변 1
별도로 old_ship_no 를 만들어서 따로 추가 저장을 해두어야 되지 않을까요?
<?php
if ($old_ship_no) $old_ship_no .= ",".ship_no;
else $old_ship_no = ship_no;
?>
<input type="hidden" id="old_ship_no" name="old_ship_no" value="<?php echo $old_ship_no; ?>" class="frm_input" size="20">
<input type="text" id="ship_no" name="ship_no" value="<?php echo $ship_no; ?>" class="frm_input" size="20">
그리고 뒤에 ship_no 쿼리 부분은 old_ship_no 로 바꾸구요 ^^
!-->
답변을 작성하시기 전에 로그인 해주세요.