도대체 모르겠습니다
본문
주문 내역에서 체크된 것만 엑셀로 받는걸 만들고 있습니다
주문 내역에서 버튼은
<span onclick="Excel()">[excel]</span>
이것이고
스크립트는
function Excel() {
var fm = document.forderlist;
fm.target = "hiddenframe";
fm.action = "orderlist_ex2.php";
fm.method = "post";
fm.submit();
}
이것입니다.
orderlist_ex2.php 의 내용은
<?
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=file.xls");
header("Content-Description: PHP4 Generated Data");
include "_common.php";
if($_POST['chk']) {
for ($i=0; $i<count($_POST['chk']); $i++) {
$k = $_POST['chk'][$i];
$od_id[] = $_POST['od_id'][$k];
}
$od = implode(", ", $od_id);
$where = "WHERE od_id IN($od)";
}
?>
<table border="1">
<tr>
<th>od_id</th>
</tr>
<?
$que = sql_query("SELECT * FROM {$g5['g5_shop_order_table']} $where order by od_id");
while($row = sql_fetch_array($que)) {
?>
<tr>
<td style='mso-number-format:\@;'><?=$row['od_id']?></td>
</tr>
<?
}
?>
</table>
입니다. 정상적으로 엑셀은 다운 되는데 선택된 것이 아닌 현재 페이지 전체의 주문번호가 나오네요.
어디가 잘 못 된 걸까요? ㅠㅠ
답변 3
아래에서도 여러번 설명드렸는데..아직도 이해를 못하신듯해서요..
/adm/board_list_update.php 관리자쪽 이쪽을 참고 해보세요~
<?
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=file.xls");
header("Content-Description: PHP4 Generated Data");
include "_common.php";
?>
<table border="1">
<tr>
<th>od_id</th>
</tr>
<?
if ($_POST['act_button'] == "선택엑셀") {
for ($i=0; $i<count($_POST['chk']); $i++) {
$k = $_POST['chk'][$i];
$od_id = $_POST['od_id'][$k];
while($row = sql_fetch_array($od_id)) {
?>
<tr>
<td style='mso-number-format:\@;'><?=$row['od_id']?></td>
</tr>
<?
}}}
?>
</table>
이렇게 해봤는데 이건 아예 안나오네요 ㅠㅠ
나름 설명을 잘 드리고 예제도 드렸는데요...
죄송하지만 그냥 의뢰하시는게 더 효과적일듯하네요..