묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
체크된 값들이 배열로 넘어가야하는데 안넘어가요 ㅠㅠ
2009.05.11 09:42
첫번째 admin2.php 입니다....
<?
session_start();
include "../include/config.php";
include "../include/util.php";
$connect=my_connect($hostName,$userName,$userPassword,$dbName);
$limit=100;
if (!$passover) {
$passover=0;
}
$result=mysql_query("select * from member_table order by gunbun desc limit $passover,$limit",$connect);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ko" xml:lang="ko">
<head>
<meta http-equiv="Content-Type" content="text/htm/; charset=eun-kr" />
<title></title>
<link type="text/css" rel="stylesheet" href="/../css/index.css" media="screen" />
<link type="text/css" rel="stylesheet" href="/../css/administrator.css" media="screen" />
<script language="Javascript">
function edit(){
var x= 0;
var obj = document.getElementsByName("gunbuns[]");
for (var i=0; i < obj.length; i++) {
if(obj[i].checked == true) {
x++;
}
}
if(x == 0){
window.alert("선택된 항목이 없습니다.");
return false;
}
if(confirm('입력하신 부분을 수정하시겠습니까?')){
document.write.action="admin2_ok.php";
document.write.method="post";
document.write.submit();
}else{
}
}
</script>
</head>
<body>
<div>
<?php include('/../head.php');?>
<div id="main">
<?php include('/../lefter.php');?>
<div id="content">
<?php include('submenu07.php');?>
<div id="admin">
<table class="1month">
<tr>
<td>
<div class="back">
<p>1개월 이내 퇴거 예상자</p>
</div>
</td>
</tr>
<tr>
<td>
<span style="MARGIN-LEFT: 3px;">
<table class="movein" align="center">
<tr>
<th>
동수
</th>
<th>
호수
</th>
<th>
소속
</th>
<th>
나이
</th>
<th>
직책
</th>
<th>
주민
</th>
<th>
성명
</th>
<th>
거주인원
</th>
<th>
입주일
</th>
<th>
퇴거 예상일
</th>
</tr>
<tr>
<td>
101
</td>
<td>
101
</td>
<td>
dddd
</td>
<td>
dd
</td>
<td>
dddd
</td>
<td>
sssss
</td>
<td>
ddd
</td>
<td>
1
</td>
<td>
07.7.21
</td>
<td>
08.4.12
</td>
</tr>
</table>
</span>
</td>
</tr>
</table>
<br>
<form method="post" name="write">
<table class="border">
<tr>
<td>
<div class="back">
<p style="padding-left:10px;">대기자순번/입주입력</p>
</div>
</td>
</tr>
<tr>
<td>
<span style="MARGIN-LEFT: 3px;">
<table class="movein" align="center">
<tr>
<th class="admin">
선택
</th>
<th>
소속
</th>
<th>
나이
</th>
<th>
직책
</th>
<th>
주민
</th>
<th>
성명
</th>
<th>
거주<br>인원
</th>
<th>
입주요청일
</th>
<th class="admin">
대기<br>순번
</th>
<th class="admin">
입주예상일<br>
(년,월,일)
</th>
<th class="admin">
동수
</th>
<th class="admin">
호수
</th>
</tr>
<?
$i=0;
while($row=mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>";
echo "<input type='checkbox' name='+ '+ 'gunbuns[]' value='$i'>";
echo "<input type='hidden' name='rowgunbuns[]' value='$row[gunbun]'>";
echo "</td>";
echo "<td>";
echo "$row[force_b1]<br>";
echo $row[force_b2];
echo "</td>";
echo "<td>";
echo $row[grade];
echo "</td>";
echo "<td>";
echo $row[job];
echo "</td>";
echo "<td>";
echo $row[gunbun];
echo "</td>";
echo "<td>";
echo $row[name];
echo "</td>";
echo "<td>";
echo $row[persons];
echo "</td>";
echo "<td>";
echo "$row[years]. $row[month]. $row[days]";
echo "</td>";
echo "<td>";
echo "<input type='text' name='sequents[]' value='$row[sequent]' size='1' maxlength='2'>";
echo "</td>";
echo "<td>";
echo "<input type='text' name='ayears[]' value='$row[ayear]' size='1' maxlength='2'>";
echo "<input type='text' name='amonths[]' value='$row[amonth]' size='1' maxlength='2'>";
echo "<input type='text' name='adays[]' value='$row[aday]' size='1' maxlength='2'>";
echo "</td>";
echo "<td>";
echo "<input type='text' name='dongs[]' value='$row[dong]' size='2' maxlength='3'>";
echo "</td>";
echo "<td>";
echo "<input type='text' name='hos[]' value='$row[ho]' size='2' maxlength='3'>";
echo "</td>";
echo"</tr>";
$i++;
}
?>
</table>
<table width="670px">
<tr>
<td align="right">
<input type="button" value="입력">
</td>
</tr>
</table>
</form>
</span>
</td>
</tr>
</table>
</div>
</div>
</div>
<?php include('+ '/../copyright.php');?>
</div>
</body>
</html>
2번쨰 admin2_ok.php 입니다.
<?
session_start();
include "../include/config.php";
include "../include/util.php";
$connect=my_connect($hostName,$userName,$userPassword,$dbName);
$query="SELECT gunbun FROM member_table";
$result=mysql_query($query, $connect);
$No=$_POST["No"];
$gunbun=$_POST["gunbun"];
$name=$_POST["name"];
$married=$_POST["married"];
$sex=$_POST["sex"];
$grade=$_POST["grade"];
$force_b1=$_POST["force_b1"];
$force_b2=$_POST["force_b2"];
$job=$_POST["job"];
$persons=$_POST["persons"];
$phone=$_POST["phone"];
$remark=$_POST["remark"];
$years=$_POST["years"];
$month=$_POST["month"];
$days=$_POST["days"];
$sequent=$_POST["sequent"];
$ayear=$_POST["ayear"];
$amonth=$_POST["amonth"];
$aday=$_POST["aday"];
$dong=$_POST["dong"];
$ho=$_POST["ho"];
for($i=0;$i<count($gunbuns);$i++){
$new_num = $gunbuns[$i];
$query="UPDATE member_table SET sequent='$sequents[$new_num]',ayear='$ayears[$new_num]',amonth='$amonths[$new_num]',aday='$adays[$new_num]',dong='$dongs[$new_num]',ho='$hos[$new_num]' WHERE gunbun='$row_num[$new_num]'";
$result=mysql_query($query, $connect);
}
if(!$result) {
err_msg('데이터베이스오류가 발생?');
}
else {
echo("<script>
window.alert('입력이 되었습니다.');
</script>");
echo "<meta http-equiv='Refresh' content='0; URL=/07administrator/admin2.php'>";
}
?>
잘못된게 있나요..??? ㅠㅠ 수정이 안되네요 값들이...아오......
제발 부탁드려요 ㅠㅠ 어디가 잘못된건지...아니면 잘 못 한건지 지적이랑 도움의 글 부탁드립니다...
<?
session_start();
include "../include/config.php";
include "../include/util.php";
$connect=my_connect($hostName,$userName,$userPassword,$dbName);
$limit=100;
if (!$passover) {
$passover=0;
}
$result=mysql_query("select * from member_table order by gunbun desc limit $passover,$limit",$connect);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ko" xml:lang="ko">
<head>
<meta http-equiv="Content-Type" content="text/htm/; charset=eun-kr" />
<title></title>
<link type="text/css" rel="stylesheet" href="/../css/index.css" media="screen" />
<link type="text/css" rel="stylesheet" href="/../css/administrator.css" media="screen" />
<script language="Javascript">
function edit(){
var x= 0;
var obj = document.getElementsByName("gunbuns[]");
for (var i=0; i < obj.length; i++) {
if(obj[i].checked == true) {
x++;
}
}
if(x == 0){
window.alert("선택된 항목이 없습니다.");
return false;
}
if(confirm('입력하신 부분을 수정하시겠습니까?')){
document.write.action="admin2_ok.php";
document.write.method="post";
document.write.submit();
}else{
}
}
</script>
</head>
<body>
<div>
<?php include('/../head.php');?>
<div id="main">
<?php include('/../lefter.php');?>
<div id="content">
<?php include('submenu07.php');?>
<div id="admin">
<table class="1month">
<tr>
<td>
<div class="back">
<p>1개월 이내 퇴거 예상자</p>
</div>
</td>
</tr>
<tr>
<td>
<span style="MARGIN-LEFT: 3px;">
<table class="movein" align="center">
<tr>
<th>
동수
</th>
<th>
호수
</th>
<th>
소속
</th>
<th>
나이
</th>
<th>
직책
</th>
<th>
주민
</th>
<th>
성명
</th>
<th>
거주인원
</th>
<th>
입주일
</th>
<th>
퇴거 예상일
</th>
</tr>
<tr>
<td>
101
</td>
<td>
101
</td>
<td>
dddd
</td>
<td>
dd
</td>
<td>
dddd
</td>
<td>
sssss
</td>
<td>
ddd
</td>
<td>
1
</td>
<td>
07.7.21
</td>
<td>
08.4.12
</td>
</tr>
</table>
</span>
</td>
</tr>
</table>
<br>
<form method="post" name="write">
<table class="border">
<tr>
<td>
<div class="back">
<p style="padding-left:10px;">대기자순번/입주입력</p>
</div>
</td>
</tr>
<tr>
<td>
<span style="MARGIN-LEFT: 3px;">
<table class="movein" align="center">
<tr>
<th class="admin">
선택
</th>
<th>
소속
</th>
<th>
나이
</th>
<th>
직책
</th>
<th>
주민
</th>
<th>
성명
</th>
<th>
거주<br>인원
</th>
<th>
입주요청일
</th>
<th class="admin">
대기<br>순번
</th>
<th class="admin">
입주예상일<br>
(년,월,일)
</th>
<th class="admin">
동수
</th>
<th class="admin">
호수
</th>
</tr>
<?
$i=0;
while($row=mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>";
echo "<input type='checkbox' name='+ '+ 'gunbuns[]' value='$i'>";
echo "<input type='hidden' name='rowgunbuns[]' value='$row[gunbun]'>";
echo "</td>";
echo "<td>";
echo "$row[force_b1]<br>";
echo $row[force_b2];
echo "</td>";
echo "<td>";
echo $row[grade];
echo "</td>";
echo "<td>";
echo $row[job];
echo "</td>";
echo "<td>";
echo $row[gunbun];
echo "</td>";
echo "<td>";
echo $row[name];
echo "</td>";
echo "<td>";
echo $row[persons];
echo "</td>";
echo "<td>";
echo "$row[years]. $row[month]. $row[days]";
echo "</td>";
echo "<td>";
echo "<input type='text' name='sequents[]' value='$row[sequent]' size='1' maxlength='2'>";
echo "</td>";
echo "<td>";
echo "<input type='text' name='ayears[]' value='$row[ayear]' size='1' maxlength='2'>";
echo "<input type='text' name='amonths[]' value='$row[amonth]' size='1' maxlength='2'>";
echo "<input type='text' name='adays[]' value='$row[aday]' size='1' maxlength='2'>";
echo "</td>";
echo "<td>";
echo "<input type='text' name='dongs[]' value='$row[dong]' size='2' maxlength='3'>";
echo "</td>";
echo "<td>";
echo "<input type='text' name='hos[]' value='$row[ho]' size='2' maxlength='3'>";
echo "</td>";
echo"</tr>";
$i++;
}
?>
</table>
<table width="670px">
<tr>
<td align="right">
<input type="button" value="입력">
</td>
</tr>
</table>
</form>
</span>
</td>
</tr>
</table>
</div>
</div>
</div>
<?php include('+ '/../copyright.php');?>
</div>
</body>
</html>
2번쨰 admin2_ok.php 입니다.
<?
session_start();
include "../include/config.php";
include "../include/util.php";
$connect=my_connect($hostName,$userName,$userPassword,$dbName);
$query="SELECT gunbun FROM member_table";
$result=mysql_query($query, $connect);
$No=$_POST["No"];
$gunbun=$_POST["gunbun"];
$name=$_POST["name"];
$married=$_POST["married"];
$sex=$_POST["sex"];
$grade=$_POST["grade"];
$force_b1=$_POST["force_b1"];
$force_b2=$_POST["force_b2"];
$job=$_POST["job"];
$persons=$_POST["persons"];
$phone=$_POST["phone"];
$remark=$_POST["remark"];
$years=$_POST["years"];
$month=$_POST["month"];
$days=$_POST["days"];
$sequent=$_POST["sequent"];
$ayear=$_POST["ayear"];
$amonth=$_POST["amonth"];
$aday=$_POST["aday"];
$dong=$_POST["dong"];
$ho=$_POST["ho"];
for($i=0;$i<count($gunbuns);$i++){
$new_num = $gunbuns[$i];
$query="UPDATE member_table SET sequent='$sequents[$new_num]',ayear='$ayears[$new_num]',amonth='$amonths[$new_num]',aday='$adays[$new_num]',dong='$dongs[$new_num]',ho='$hos[$new_num]' WHERE gunbun='$row_num[$new_num]'";
$result=mysql_query($query, $connect);
}
if(!$result) {
err_msg('데이터베이스오류가 발생?');
}
else {
echo("<script>
window.alert('입력이 되었습니다.');
</script>");
echo "<meta http-equiv='Refresh' content='0; URL=/07administrator/admin2.php'>";
}
?>
잘못된게 있나요..??? ㅠㅠ 수정이 안되네요 값들이...아오......
제발 부탁드려요 ㅠㅠ 어디가 잘못된건지...아니면 잘 못 한건지 지적이랑 도움의 글 부탁드립니다...