hi there ...
i need the data to be deleted from the database upon clicking delete button possible ...
pls help ...
thanks ....
<?
include ("topbar.php");
print ("<table width=800 border=0 align=center>");
print ("<tr>");
print ("<td valign=top><table width=300 border=0>");
print ("<tr>");
print ("<td colspan=2><font size=4><b> Delete Account</b></font></td>");
print ("</tr>");
print ("<tr>");
print ("<td width=150><font size=3>Department:</font><
/td>");
print ("<td width=150>");
$query = "select * from Department order by deptName";
$query_result = mysql_query ($query, $mysql_connection);
print("<form action='deleteaccount.php'
method=POST name='department'>");
// Use a droplist to display all categories from the Category table
$displaydepartment = "<select name='deptID' onchange='return refresh_page(this.value)'>
<option value=0> -- Select One -- </option>";
while ($departmentlist = mysql_fetch_array($query_r
esult))
{
$deptID = $departmentlist["deptID"];
$deptName = $departmentlist["deptName"
];
if (!empty($_GET['deptID']))
{
// $displaydepartment .= "<option value = ".$deptID.">".$deptName."<
/option>";
$displaydepartment .= "<option value ='".$deptID."' ". ($deptID==$_REQUEST["deptI
D"]?"selec
ted":"")."
>".$deptNa
me."</opti
on>";
}
else
{
//$displaydepartment .= "<option value ='".$deptID."' ". ($deptID==$_REQUEST["deptI
D"]?"selec
ted":"")."
>".$deptNa
me."</opti
on>";
$displaydepartment .= "<option value = ".$deptID.">".$deptName."<
/option>";
}
}
$displaydepartment .= "</select>";
print $displaydepartment;
print ("</td>");
print ("</tr>");
print ("<tr>");
print ("<td><font size=3>Staff Name:</font></td>");
print ("<td>");
if (!empty($_GET['deptID']))
{
$query1 = "select * from Staff where deptID='".$_REQUEST["deptI
D"]."' order by staffName";
// $query1 = "select * from Staff where deptID= '$deptID' order by staffName";
$query_result1 = mysql_query ($query1, $mysql_connection);
}
else
{
$query1 = "select * from Staff where deptID= '0' order by staffName";
$query_result1 = mysql_query ($query1, $mysql_connection);
}
print("<form action='deleteaccount.php'
method=POST>");
// Use a droplist to display all categories from the Category table
$displaystaff = "<select name='staffID'> <option value=0> -- Select One -- </option>";
while ($stafflist = mysql_fetch_array($query_r
esult1))
{
$staffID = $stafflist["staffID"];
$staffName = $stafflist["staffName"];
$displaystaff .= "<option value = ".$staffID.">".$staffName.
"</option>
";
}
$displaystaff .= "</select>";
print $displaystaff;
print ("</td>");
print ("</tr>");
print ("<tr>");
print ("<td>");
print ("<input type=reset type=reset value='Clear'></td>");
print ("<td>");
print ("<input type='submit' name ='delete' value='Delete'></td>");
print ("</tr>");
print ("<tr>");
print ("<td> </td>");
print ("<td> </td>");
print ("</tr>");
print ("</table></td>");
print ("</form>");
print ("</tr>");
include ("bottombar.php");
?>
<script language="javascript">
function refresh_page(dept_id)
{
top.location.href= "deleteaccount.php?deptID=
" + dept_id; //change department.php with your php file name
return false;
}
</script>