Delete Button
Posted: Tue May 01, 2007 4:35 pm
I had help from someone on the site, he helped me make a delete button and I started changing some of the code around and removing some things, and now the buttons arn't working right and I can't figure out why and I need this in about 90 minuets... can anyone help me out if they see anything that would cause these buttons not to delete the entries when delete is clicked?
Code: Select all
<html>
<head>
<title>
<?
include "admin_panel_title.php";?>
</title>
</head>
<body bgcolor="#000000" text="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" link="#FF3333" vlink="#CC0000" alink="#CC0000">
<center>
<img src="/newadmin/Administration_Panel_Banner.png"><br>
<h3>Remove a Person from a Duty Crew</h3>
<?
//include "http://delranfire.org/members/connect.phtml";
include "connect.phtml";
$db="delranfire_org";
$query="select * from dutycrews order by name desc";
//echo $query;
if(isset($_GET['id']) && isset($_GET['action'])) {
$tempResult = mysql_db_query($db, "SELECT * FROM dutycrews WHERE id=" . mysql_escape_string($_GET['id']), $connection);
if(mysql_num_rows($tempResult) > 0) {
if($_GET['action'] == "del") {
mysql_db_query($db, "DELETE FROM dutycrews WHERE id=" . mysql_escape_string($_GET['id']), $connection);
}
}
}
$rows=mysql_db_query($db,$query,$connection) or die("Error in query:$query. " .mysql_error());
?>
<script language=javascript>
function deleteEntryOld(entry)
{
var moo = '\"DELETE FROM dutycrews WHERE id=\'' + entry + '\'\"';
<?
$qu = "?><script language=javascript>document.write(moo)</script><?";
mysql_query($qu);
?>
var sURL = unescape(window.location.pathname);
window.location.href = sURL;
}
</script> </font>
<table width="70%" border="0" cellspacing="0" cellpadding="0" align=center>
<tr>
<td> <b><font face="Arial, Helvetica, sans-serif" size="1">Name</font></b></td>
<td> <b><font face="Arial, Helvetica, sans-serif" size="1">Station</font></b></td>
<td> <b><font face="Arial, Helvetica, sans-serif" size="1">Date</font></b></td>
<td> <b><font face="Arial, Helvetica, sans-serif" size="1">Start</font></b></td>
<td> <b><font face="Arial, Helvetica, sans-serif" size="1">Finish</font></b></td>
<td> <b><font face="Arial, Helvetica, sans-serif" size="1">Position</font></b></td>
<td> <b><font face="Arial, Helvetica, sans-serif" size="1">Truck</font></b></td>
</font></td></tr>
<tr><td colspan=8><hr></td></tr>
<?
while($row=mysql_fetch_array($rows)){
?>
<td ><font face="Arial, Helvetica, sans-serif" size="1" color="#FFFFFF">
<?
$name="$row[name]";
echo $row["name"];?>
</font></td>
<td ><font face="Arial, Helvetica, sans-serif" size="1" color="#FFFFFF">
<?echo $row["station"];?>
</font></td>
<td ><font face="Arial, Helvetica, sans-serif" size="1" color="#FFFFFF">
<?echo $row["dat"];?>
</font>
<font face="Arial, Helvetica, sans-serif" size="1" color="#FFFFFF">
<?echo $row["dat_day"];?>
</font></td>
<td><font face="Arial, Helvetica, sans-serif" size="1" color="#FFFFFF">
<?echo $row["fr"];?>
</font></td>
<td ><font face="Arial, Helvetica, sans-serif" size="1" color="#FFFFFF">
<?echo $row["toa"];?>
</font></td>
<td ><font face="Arial, Helvetica, sans-serif" size="1" color="#FFFFFF">
<?echo $row["position"];?>
</font></td>
<td ><font face="Arial, Helvetica, sans-serif" size="1" color="#FFFFFF">
<?echo $row["truck"];?>
<td colspan=8 align=right><input type=button value="Delete" onClick="deleteEntry('<?echo $row["id"];?>')"> </input></td></tr>
</font></td></tr>
<tr><td colspan=8><hr></td></tr>
<?}?>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<center><a href="/newadmin/">Back to Administration Panel</a></center>
</body></html>
<?
mysql_close();
?>