老師
我做了一個php,
是給同事登記影印量,
方便計算成本
<body background="temp/bg_gray.jpg"><center>
<? include("adminmenu.php"); ?>
<table width="728" height="300"><tr><td valign="top">
<?
include("opendata.php");
include("selectmanagecopydate.php");
if (isset($_POST["selectcopy"]))
$referdate=$_POST["selectcopy"];
$sql="select * from copy where month=".$referdate." order by copydate";
$record = Mysql_query($sql);
echo Mysql_error();
echo "<script language=JavaScript>
function selectedAll() { ";
while(List($copystamp,$copydate,$month,$staff,$work,$color,$afour,$white,$oneside,$quantity,$price) = Mysql_fetch_row($record)){
echo "document.form2.".$staff.$id.".checked=true;";
}
echo "}</script>";
echo "<script language=JavaScript>
function deselectedAll() { ";
$record = Mysql_query($sql);
while(List($copystamp,$copydate,$month,$staff,$work,$color,$afour,$white,$oneside,$quantity,$price) = Mysql_fetch_row($record)){
echo "document.form2.".$staff.$id.".checked=false;";
}
echo "}</script>";
echo "<form name=form2 method=post action=deletecopy.php>";
echo "<center><table bordercolor=#FFFFFF>
<td><div align=center>種類</div></td>
<td><div align=center>日期</div></td>
<td><div align=center>經手人</div></td>
<td><div align=center>內容</div></td>
<td><div align=center>印色</div></td>
<td><div align=center>紙張</div></td>
<td><div align=center>色紙</div></td>
<td><div align=center>雙面</div></td>
<td><div align=center>張數</div></td>
<td><div align=center>$$</div></td>
<td><div align=center>刪除?</div></td></tr>";
$record = Mysql_query($sql);
$i=0;
while(List($copystamp,$copydate,$month,$staff,$work,$color,$afour,$white,$oneside,$quantity,$price) = Mysql_fetch_row($record)){
if($i%2==0)
echo "<tr bgcolor=#CCCCCC>";
else
echo "<tr>";
echo "
<td><div align=center>".$copystamp."</div></td>
<td><div align=center>".$copydate."</div></td>
<td><div align=center>".$staff."</div></td>
<td width=200><div align=left>".$work."</div></td>
<td><div align=center>".$color."</div></td>
<td><div align=center>".$afour."</div></td>
<td><div align=center>".$white."</div></td>
<td><div align=center>".$oneside."</div></td>
<td><div align=right>".$quantity."</div></td>
<td><div align=right>".$price."</div></td>
<td><div align=center><input name=".$staff.$id." type=checkbox value=del></td></tr>";
$i++;
}
echo "<tr><td colspan=23><div align=right><button onClick=document.location='deletecopy.php'>小心!全部刪除</button></div></td></tr>";
echo "</table><center>";
?>
</td>
</tr>
</form>
</table>
但我想問..
我想做delete check box
但不成功..
why?每月都要在網頁
phpMyAdmin 2.3.2 網頁內delete
好煩...
我已做了deletecopy.php
<?
include("opendata.php");
$sql="select * FROM copy";
$record=Mysql_query($sql);
while(List($month) = Mysql_fetch_row($record)){
if (isset($_POST[$month])){
$delsql="delete from copy where month ='".$month."'";
Mysql_query($delsql);
echo Mysql_error();
}
}
Header("Location:selectmanagecopy.php");
?>
老師請教教我吧!
thanks