이전 목록 다음
미채택 완료

리스트에서 셀렉트박스 선택시 바로수정

관리자가 목록에서 예약상태 수정을 바로바로 할 수 있게하고싶어요!
"신청"으로 되어있는 셀렉트박스를 "처리중"으로 바꾸면 "업데이트되었습니다."라는
창이 뜨고 "처리중"으로 수정이 되는거예요.
부탁드립니다 ㅜ.ㅜ
 
list.skin.php
Copy
<? if($is_admin == "super"){ ?>    <td width="70">     <select onchange="javascript:change_status(this, <?=$list[$i][wr_id]?>)">            <option value="1" <? if ($list[$i][wr_1]=='1') echo 'selected'; ?>>신청      <option value="2" <? if ($list[$i][wr_1]=='2') echo 'selected'; ?>>처리중      <option value="3" <? if ($list[$i][wr_1]=='3') echo 'selected'; ?>>완료     </select>    </td>    <td width="1"></td>   <? } ?>
<form id=status_update name=status_update action='/skin/board/pension_reserve/update_status.php' target='status_result' method='post'> <input type=hidden name='bo_table' value='<?=$write_table?>'> <input type=hidden name='status_val'> <input type=hidden name='wr_id'></form>
<iframe name="status_result" width="0" height="0"></iframe>
<script language="JavaScript">if ('<?=$sca?>') document.fcategory.sca.value = '<?=$sca?>';if ('<?=$stx?>') {    document.fsearch.sfl.value = '<?=$sfl?>';    document.fsearch.sop.value = '<?=$sop?>';}
function change_status(obj, wr_id) {  document.status_update.status_val.value = obj.selectedIndex; document.status_update.wr_id.value = wr_id;  document.status_update.submit();}</script>
 
update_status.php
Copy
<?include_once("./_common.php");
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가 
$sql1  = "update $bo_table set wr_1 = '$status_val' where wr_id = '$wr_id' ";sql_query($sql1);
?><script>alert("업데이트 되었습니다."); </script>

답변 4개 / 댓글 1개

많은 도움이 되었습니다. 감사합니다.

진서기님이 곧 답이요
폼으로 하지 않아도 됩니다.
히든 프레임으로 넘기실때 get 방식으로 넘겨보세요.
Copy
<a href='skin/board/pension_reserve/update_status.php?bo_tabe=<?php echo $bo_table?>&wr_id=<?php echo $wr_id?>&status_val=update' target='status_result'>[업데이트]</a>
<?
include_once("./_common.php");
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가 
$sql1 = "update $bo_table set wr_1 = '$status_val' where wr_id = '$wr_id' ";
sql_query($sql1);
?>
<script>
alert("업데이트 되었습니다."); 
//부모창을 리프레시 시켜주는 스크립트 넣으세요
top.location.reload();
</script>
alert(document.status_update.status_val.value);
값이 무엇으로 넘어오는지 먼저 확인 해보세요
그다음 update페이지에서 값이 뭘로 넘어왔는지 보시구요

답변에 대한 댓글 1개

현재 제가 작업 소스로는 무반응입니다.
리스트스킨파일에 알려주신 소스 넣었더니 게시판관리자 모드로 넘어갑니다.
제가 초보라 값을 어떻게 확인하라고 하시는 지 ㅜ.ㅜ

답변을 작성하려면 로그인이 필요합니다.