묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
앞페이지의 체크된 것만 받아와서 뿌리려는데 안되여 고수님들의 조언 부탁드립니다
2003.04.14 20:28
체크된 곳만 그 정보를 가져와서 그 다음페이지에서 연속적으로 그 데이타를 처리하려고 하는데 그 다음 페이지에 그 정보가 나오지 않습니다. 이 문제 점 해결해주세여 이틀동안 돌머리로 머리만 뿌수고 있습니다. 도움좀 주세여
=========================list.page==================================
<SCRIPT LANGUAGE='JavaScript'>
<!--
function printsubmit(print) {
document.print.submit();
}
//-->
</SCRIPT>
<?
include "lib.php";
$mc=mysql_connect("localhost","","");
$ms=mysql_select_db("",$mc);
$num_per_page = 10;
$page_per_block = 10;
if(!$page) {
$page = 1;
}
if($mode == "search") {
$result = mysql_query("select no, subject, date, name, mass, age, mail, tel, phone, comment from member_table where $keyfield like'$keyword%' order by date desc");
} else if($mode == "member") {
$result = mysql_query("select no, subject, date, name, mass, age, mail, tel, phone, comment from member_table where userlevel='2'order by date desc");
} else {
$result = mysql_query("select no, subject, date, name, mass, age, mail, tel, phone, comment from member_table order by date desc");
}
$total_record = mysql_num_rows($result);
$date = date("Y/m/d",$row->date);
if(!$total_record) {
$first = 1;
$last = 0;
} else {
$first = $num_per_page*($page-1);
$last = $num_per_page*$page;
$IsNext = $total_record - $last;
if($IsNext > 0) {
$last -= 1;
} else {
$last = $total_record - 1;
}
}
$total_page = ceil($total_record/$num_per_page);
?>
<HTML>
<HEAD>
<TITLE>회원 리스트</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=euc-kr">
<style type="text/css">
a:link { text-decoration: none; color: #000000 }
a:active { text-decoration: none; color: #000000 }
a:visited { text-decoration: none; color: #000000 }
a:hover { text-decoration : underline; color: red}
body { font-family: "굴림"; font-size: 9pt; color: #000000;}
input { font-family: "굴림"; font-size: 9pt; color: #000000}
table { font-family: "굴림"; font-size: 9pt; color: #000000}
.input { border: solid 1px #000000; background-color:white;}
</style>
</HEAD>
<BODY>
<table width="860" border="1" align=center cellpadding=0 cellspacing=0 >
<tr>
<td valign="top">
<table width="860" align=center cellpadding=0 cellspacing=0>
<tr>
<td>
<table cellpadding=0 cellspacing=0 align=center width=100%>
<tr>
<?
if($mode == "member") {
echo "<td align=center><font color=white><b>멤버 리스트</b></font></td>";
} else {
echo "<td align=center><font color=white><b>회원 리스트</b></font></td>";
}
?>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table cellpadding=0 cellspacing=0 align=center width="860">
<tr>
<td>Page: <b><?echo "${page}/${total_page}"?></b></td>
<td align=right>총질문원수 : <b><?echo "${total_record}명"?></b></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table cellpadding=0 cellspacing=0 align=center width="860">
<tr>
<td align=center bgcolor="#CCCCCC" width="40"><strong>No</strong></td>
<td align=center bgcolor="#CCCCCC" width="40"><strong>과목별</strong></td>
<td align=center bgcolor="#CCCCCC" width="80"><strong>접수일</strong></td>
<td align=center bgcolor="#CCCCCC" width="60"><strong>비회원명</strong></td>
<td align=center bgcolor="#CCCCCC" width="80"><strong>매체</strong></td>
<td align=center bgcolor="#CCCCCC" width="60"><strong>나이</strong></td>
<td align=center bgcolor="#CCCCCC" width="140"><strong>메일</strong></td>
<td align=center bgcolor="#CCCCCC" width="120"><strong>전화번호</strong></td>
<td align=center bgcolor="#CCCCCC" width="120"><strong>핸드폰</strong></td>
<td align=center bgcolor="#CCCCCC" width="80"><strong>질문 내용</strong></td>
<td align=center bgcolor="#CCCCCC" width="40"><strong></strong></td>
</tr>
</tr>
</table>
</td>
</tr>
<?
$num = $total_record - $num_per_page*($page-1);
for($i=$first; $i<=$last; $i++) {
$no = mysql_result($result,$i,0);
$subject = mysql_result($result,$i,1);
$date = mysql_result($result,$i,2);
$name = mysql_result($result,$i,3);
$mass = mysql_result($result,$i,4);
$age = mysql_result($result,$i,5);
$mail = mysql_result($result,$i,6);
$tel = mysql_result($result,$i,7);
$phone = mysql_result($result,$i,8);
$comment = mysql_result($result,$i,9);
$cutcommment = kstrcut($comment, 10, "...");
echo "
<tr>
<td>
<table cellpadding=0 cellspacing=1 width=100%>
<tr>
<td align=center width=40>$no</td>
<td align=center width=40>$subject</td>
<td align=center width=80>$date</td>
<td align=center width=60><a href='member_info.php?no=$no&page=$page'>$name</td>
<td align=center width=80>$mass</td>
<td align=center width=60>$age</td>
<td align=center width=140>$mail</td>
<td align=left width=120>$tel</td>
<td align=left width=120>$phone</td>
<td align=left width=80>$cutcommment</td>
<td align=center width=40><INPUT TYPE=checkbox NAME=check[] value=$no></td>
</tr>
</table>
</td>
</tr>
";
$num--;
}
?>
</table>
</td>
</tr>
<tr>
<td>
<table align=center cellpadding=0 cellspacing=0>
<?
$total_block = ceil($total_page/$page_per_block);
$block = ceil($page/$page_per_block);
$first_page = ($block-1) * $page_per_block;
$last_page = $block*$page_per_block;
if($block >= $total_block) {
$last_page = $total_page;
}
if($block > 1) {
$is_page = $first_page;
echo "<a href='member_list.php?page=$is_page'>[이전 ${page_per_block}개]</a>";
}
for($link_page=$first_page+1; $link_page<=$last_page; $link_page++) {
if($page == $link_page) {
echo "<b>$link_page</b> ";
} else {
echo "<a href='member_list.php?page=$link_page'>$link_page</a> ";
}
}
if($block < $total_block) {
$is_page = $last_page+1;
echo "<a href='member_list.php?&page=$is_page'>[다음 $page_per_block개]</a>";
}
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table cellpadding=0 cellspacing=0 align=center width=300>
<tr>
<td colspan=8 align=center>
<form name=search method=post action="<?echo $PHP_SELF?>?mode=search">
<select name="keyfield">
<option value="name" selected>이름</option>
<option value="mail">메일</option>
<option value="age">나이</option>
<option value="subject">과목</option>
</select>
<input type=text name=keyword size=20><input type=submit value="찾기">
</form>
</td>
<td> <form name="print" method="post" action="print.php?no=<?$check[$no]?>">
<input name="print" type="submit" id="print" value="프린트">
</form>
</td>
</tr>
</table>
</BODY>
</HTML>
===========================print.php=====================================
<?
$mc=mysql_connect("localhost","","");
$ms=mysql_select_db("",$mc);
for ($i=0; $i<sizeof($check);$i++){
getcontentsfromno($check[$i]);
}
##### 인자로 넘겨받은 게시물 레코드의 no 필드값으로 부터 해당 게시물을 출력하는 함수를 정의한다.
function getContentsFromno($value)
##### 데이터베이스 연결에 필요한 변수를 전역변수로 선언한다.
GLOBAL $ms;
##### 선택한 게시물의 입력값을 뽑아낸다.
$query = "select person, date, subject, mass, name, age, tel, phone, mail, comment from member_table WHERE no = $check[$no]";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
$person = $row[1];
$date = date("Y년 m월 d일,$row[2]");
$subject= $row[3];
$mass = $row[4];
$name = $row[5];
$age = $row[6];
$tel = $row[7];
$phone = $row[8];
$mail = $row[9];
$comment = $row[10];
?>
<head>
</head>
<body>
<table width="776" height="229" border="1">
<tr>
<td width="776" valign="top">
<table width="100%" height="195" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="100"><div align="center">담당자</div></td>
<td> <?echo("$person")?></td>
<td width="100">접수일</td>
<td> <?echo("$date")?></td>
</tr>
<tr>
<td><div align="center">과 목</div></td>
<td> <?echo("$subject")?></td>
<td>매체</td>
<td> <?echo("$mass")?></td>
</tr>
<tr>
<td><div align="center">비회원명</div></td>
<td> <?echo("$name")?>;</td>
<td>나이</td>
<td> <?echo("$age")?></td>
</tr>
<tr>
<td><div align="center">Tel</div></td>
<td> <?echo("$tel")?></td>
<td>핸드폰</td>
<td> <?echo("$phone")?></td>
</tr>
<tr>
<td><div align="center">이메일</div></td>
<td colspan="3"> <?echo "<a href=mailto:$mail>$mail</a>"?></td>
</tr>
<tr>
<td><div align="center">질문사항</div></td>
<td colspan="3"><?echo("$comment")?></td>
</tr>
<tr>
<td><div align="center">통화내용</div></td>
<td colspan="3"> </td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
=========================list.page==================================
<SCRIPT LANGUAGE='JavaScript'>
<!--
function printsubmit(print) {
document.print.submit();
}
//-->
</SCRIPT>
<?
include "lib.php";
$mc=mysql_connect("localhost","","");
$ms=mysql_select_db("",$mc);
$num_per_page = 10;
$page_per_block = 10;
if(!$page) {
$page = 1;
}
if($mode == "search") {
$result = mysql_query("select no, subject, date, name, mass, age, mail, tel, phone, comment from member_table where $keyfield like'$keyword%' order by date desc");
} else if($mode == "member") {
$result = mysql_query("select no, subject, date, name, mass, age, mail, tel, phone, comment from member_table where userlevel='2'order by date desc");
} else {
$result = mysql_query("select no, subject, date, name, mass, age, mail, tel, phone, comment from member_table order by date desc");
}
$total_record = mysql_num_rows($result);
$date = date("Y/m/d",$row->date);
if(!$total_record) {
$first = 1;
$last = 0;
} else {
$first = $num_per_page*($page-1);
$last = $num_per_page*$page;
$IsNext = $total_record - $last;
if($IsNext > 0) {
$last -= 1;
} else {
$last = $total_record - 1;
}
}
$total_page = ceil($total_record/$num_per_page);
?>
<HTML>
<HEAD>
<TITLE>회원 리스트</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=euc-kr">
<style type="text/css">
a:link { text-decoration: none; color: #000000 }
a:active { text-decoration: none; color: #000000 }
a:visited { text-decoration: none; color: #000000 }
a:hover { text-decoration : underline; color: red}
body { font-family: "굴림"; font-size: 9pt; color: #000000;}
input { font-family: "굴림"; font-size: 9pt; color: #000000}
table { font-family: "굴림"; font-size: 9pt; color: #000000}
.input { border: solid 1px #000000; background-color:white;}
</style>
</HEAD>
<BODY>
<table width="860" border="1" align=center cellpadding=0 cellspacing=0 >
<tr>
<td valign="top">
<table width="860" align=center cellpadding=0 cellspacing=0>
<tr>
<td>
<table cellpadding=0 cellspacing=0 align=center width=100%>
<tr>
<?
if($mode == "member") {
echo "<td align=center><font color=white><b>멤버 리스트</b></font></td>";
} else {
echo "<td align=center><font color=white><b>회원 리스트</b></font></td>";
}
?>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table cellpadding=0 cellspacing=0 align=center width="860">
<tr>
<td>Page: <b><?echo "${page}/${total_page}"?></b></td>
<td align=right>총질문원수 : <b><?echo "${total_record}명"?></b></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table cellpadding=0 cellspacing=0 align=center width="860">
<tr>
<td align=center bgcolor="#CCCCCC" width="40"><strong>No</strong></td>
<td align=center bgcolor="#CCCCCC" width="40"><strong>과목별</strong></td>
<td align=center bgcolor="#CCCCCC" width="80"><strong>접수일</strong></td>
<td align=center bgcolor="#CCCCCC" width="60"><strong>비회원명</strong></td>
<td align=center bgcolor="#CCCCCC" width="80"><strong>매체</strong></td>
<td align=center bgcolor="#CCCCCC" width="60"><strong>나이</strong></td>
<td align=center bgcolor="#CCCCCC" width="140"><strong>메일</strong></td>
<td align=center bgcolor="#CCCCCC" width="120"><strong>전화번호</strong></td>
<td align=center bgcolor="#CCCCCC" width="120"><strong>핸드폰</strong></td>
<td align=center bgcolor="#CCCCCC" width="80"><strong>질문 내용</strong></td>
<td align=center bgcolor="#CCCCCC" width="40"><strong></strong></td>
</tr>
</tr>
</table>
</td>
</tr>
<?
$num = $total_record - $num_per_page*($page-1);
for($i=$first; $i<=$last; $i++) {
$no = mysql_result($result,$i,0);
$subject = mysql_result($result,$i,1);
$date = mysql_result($result,$i,2);
$name = mysql_result($result,$i,3);
$mass = mysql_result($result,$i,4);
$age = mysql_result($result,$i,5);
$mail = mysql_result($result,$i,6);
$tel = mysql_result($result,$i,7);
$phone = mysql_result($result,$i,8);
$comment = mysql_result($result,$i,9);
$cutcommment = kstrcut($comment, 10, "...");
echo "
<tr>
<td>
<table cellpadding=0 cellspacing=1 width=100%>
<tr>
<td align=center width=40>$no</td>
<td align=center width=40>$subject</td>
<td align=center width=80>$date</td>
<td align=center width=60><a href='member_info.php?no=$no&page=$page'>$name</td>
<td align=center width=80>$mass</td>
<td align=center width=60>$age</td>
<td align=center width=140>$mail</td>
<td align=left width=120>$tel</td>
<td align=left width=120>$phone</td>
<td align=left width=80>$cutcommment</td>
<td align=center width=40><INPUT TYPE=checkbox NAME=check[] value=$no></td>
</tr>
</table>
</td>
</tr>
";
$num--;
}
?>
</table>
</td>
</tr>
<tr>
<td>
<table align=center cellpadding=0 cellspacing=0>
<?
$total_block = ceil($total_page/$page_per_block);
$block = ceil($page/$page_per_block);
$first_page = ($block-1) * $page_per_block;
$last_page = $block*$page_per_block;
if($block >= $total_block) {
$last_page = $total_page;
}
if($block > 1) {
$is_page = $first_page;
echo "<a href='member_list.php?page=$is_page'>[이전 ${page_per_block}개]</a>";
}
for($link_page=$first_page+1; $link_page<=$last_page; $link_page++) {
if($page == $link_page) {
echo "<b>$link_page</b> ";
} else {
echo "<a href='member_list.php?page=$link_page'>$link_page</a> ";
}
}
if($block < $total_block) {
$is_page = $last_page+1;
echo "<a href='member_list.php?&page=$is_page'>[다음 $page_per_block개]</a>";
}
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table cellpadding=0 cellspacing=0 align=center width=300>
<tr>
<td colspan=8 align=center>
<form name=search method=post action="<?echo $PHP_SELF?>?mode=search">
<select name="keyfield">
<option value="name" selected>이름</option>
<option value="mail">메일</option>
<option value="age">나이</option>
<option value="subject">과목</option>
</select>
<input type=text name=keyword size=20><input type=submit value="찾기">
</form>
</td>
<td> <form name="print" method="post" action="print.php?no=<?$check[$no]?>">
<input name="print" type="submit" id="print" value="프린트">
</form>
</td>
</tr>
</table>
</BODY>
</HTML>
===========================print.php=====================================
<?
$mc=mysql_connect("localhost","","");
$ms=mysql_select_db("",$mc);
for ($i=0; $i<sizeof($check);$i++){
getcontentsfromno($check[$i]);
}
##### 인자로 넘겨받은 게시물 레코드의 no 필드값으로 부터 해당 게시물을 출력하는 함수를 정의한다.
function getContentsFromno($value)
##### 데이터베이스 연결에 필요한 변수를 전역변수로 선언한다.
GLOBAL $ms;
##### 선택한 게시물의 입력값을 뽑아낸다.
$query = "select person, date, subject, mass, name, age, tel, phone, mail, comment from member_table WHERE no = $check[$no]";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
$person = $row[1];
$date = date("Y년 m월 d일,$row[2]");
$subject= $row[3];
$mass = $row[4];
$name = $row[5];
$age = $row[6];
$tel = $row[7];
$phone = $row[8];
$mail = $row[9];
$comment = $row[10];
?>
<head>
</head>
<body>
<table width="776" height="229" border="1">
<tr>
<td width="776" valign="top">
<table width="100%" height="195" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="100"><div align="center">담당자</div></td>
<td> <?echo("$person")?></td>
<td width="100">접수일</td>
<td> <?echo("$date")?></td>
</tr>
<tr>
<td><div align="center">과 목</div></td>
<td> <?echo("$subject")?></td>
<td>매체</td>
<td> <?echo("$mass")?></td>
</tr>
<tr>
<td><div align="center">비회원명</div></td>
<td> <?echo("$name")?>;</td>
<td>나이</td>
<td> <?echo("$age")?></td>
</tr>
<tr>
<td><div align="center">Tel</div></td>
<td> <?echo("$tel")?></td>
<td>핸드폰</td>
<td> <?echo("$phone")?></td>
</tr>
<tr>
<td><div align="center">이메일</div></td>
<td colspan="3"> <?echo "<a href=mailto:$mail>$mail</a>"?></td>
</tr>
<tr>
<td><div align="center">질문사항</div></td>
<td colspan="3"><?echo("$comment")?></td>
</tr>
<tr>
<td><div align="center">통화내용</div></td>
<td colspan="3"> </td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>