Hi, As the title states... I am deleting a 'subject' from a 'classroom' I view classrooms, then can click on a classroom to view the subject for that classroom. So the link where I am viewing subjects looks like:
viewsubjects.php?classroom=23
When the user selects the delete button (in a row) to remove a subject from a class, I simply want the user to be redirected back to the list of subjects for the classroom (exactly where they were before!!)
So I though this is simply a case of calling up the classroom ID within my delete script. Here is what I have:
EDIT: corrected spelling mistake in code (this was not the problem)
$subject_id = $_GET['subject_id'];
$classroom_id = $_GET['classroom_id'];
$sql = "DELETE FROM subjects WHERE subject_id=".$subject_id;
$result = mysql_query($sql, $connection)
or die("MySQL Error: ".mysql_error());
header("Location: viewsubjects.php?classroom_id=".$classroom_id);
exit();
The subject is being removed from the DB, but when I am redirected back the URI is displaying with an empty classroom ID like:
viewsubjects.php?classroom_id=
Is there a way to carry the classroom ID through successfully through the delete script so it can be displayed after, allowing the user to be redirected back to the page? Thanks for any help!