Delete Students

<?php session_name('StudentsRecords'); //session_start(); require_once('mysql_connect.php'); $domain_id = $_SESSION['domain_id']; $teacher_id = $_SESSION['teacher_id']; echo ' <!DOCTYPE html PUBLIC "-//W#C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml-tranitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/> <!--style> body {background:#3399bb;background:navy;} div {background:#333388; border:solid 2px #222266; padding:10px; text-align:justify; margin-bottom:10px; width:700px;} /* -moz-border-radius:1em; */ form {margin:0px; padding:0px;} table#outer {border:1px solid gray; margin:0px; padding:0px; background:#33bbdd; } /* -moz-border-radius:1em; */ h2 {font-size:16pt; font-weight:bold; margin:0px 0px 0px 0px; padding:0px 0px 0px 4px; } select {margin:0px 0px 0px 0px;padding:0px;} input {margin:0px 6px 0px 0px; padding:0px; width:5em;} </style--> <!--link rel="stylesheet" href="styles1.css" type="text/css" media="screen"--> <style> body {background:#ddecfe;} div {background:#333388; width:400px; border:3px groove gray; margin:0px; padding:0px; } form {margin:0px; padding:0px; } table {border:1px solid gray; margin:0px; padding:0px; width:400px;} td.sname {background:#ddecfe; width:240px; padding:0px 0px 0px 4px; font-size:12pt; font-weight:bold; } td.delbutton {text-align:center; } p {color:#ddecfe;} h2 {color:#ddecfe; margin:0px; padding:0px 0px 0px 4px; } h3 {display:inline; width:220px; margin:0px; padding:0px; font-size:12pt; font-weight:bold; } .data {width:120px; margin:0px 6px 0px 0px;} </style> </head> <body> '; //check entered values if (isset($_POST['submitted'])){ $del_domain_id = $_POST['domain_id']; $del_teacher_id = $_POST['teacher_id']; $del_student_id = $_POST['student_id']; $del_student_name = $_POST['student_name']; $query = "delete from students where domain_id = '$del_domain_id' and teacher_id = '$del_teacher_id' and student_id = '$del_student_id' "; //echo "\n<p>$query</p>\n"; $result = @mysql_query($query); if ($result){ echo "\n<h2>Student record for $del_student_name was deleted.</h2>\n"; } else { echo "\n<h2>Unable to delete Student $student_name</h2>\n"; } require_once('mysql_connect.php'); $query = "delete from allusers where domain_id = '$del_domain_id' and user_id = '$del_student_id' "; //echo "\n<p>$query</p>\n"; $result = @mysql_query($query); if ($result){ echo "\n<h2>User record for $del_student_name was deleted.</h2>\n"; } else { echo "\n<h2>Unable to delete User $student_name</h2>\n"; } } //end submitted require_once ('mysql_connect.php'); $query = "select * from students order by student_name"; //echo "<p>$query</p>"; $result = @mysql_query($query); if ($result){ echo "<div> <h2>Delete Students</h2> <table>"; while ($row = mysql_fetch_array($result,MYSQL_ASSOC)){ echo "<tr> <td>"; echo "<form method=\"POST\" action=\"teachers_delete_students.php?".SID."\">"; echo "<table><tr>"; echo "<td>"; echo "<input type=\"hidden\" name=\"submitted\" value=\"TRUE\" />"; echo "<input type=\"hidden\" name=\"domain_id\" value=\"".$row['domain_id']."\">&nbsp;"; echo "<input type=\"hidden\" name=\"teacher_id\" value=\"".$row['teacher_id']."\">&nbsp;"; echo "<input type=\"hidden\" name=\"student_id\" value=\"".$row['student_id']."\">&nbsp;"; echo "<input type=\"hidden\" name=\"student_name\" value=\"".$row['student_name']."\">&nbsp;"; echo "</td>"; echo "<td class=\"sname\">".$row['student_name']."</td>"; echo "<td class=\"delbutton\"><img src=\"delete_button.gif\"></td>"; echo "</tr></table>"; echo "</form>\n </td> </tr>"; } echo " </table> </div>"; } else{ echo 'Problem: Unable to retrieve data at this time. Administrators have been notified. Try again Later.'; } echo '</body></html>'; mysql_close(); ?>