HalRau Posted January 4, 2012 Report Share Posted January 4, 2012 First of all thank you for writing this script and putting it on the Internet. I have modified the Add, Edit and Delete script to my database. Everything works fine except the delete page. Here is the code I have on that page: <?php /* DELETE.PHP Deletes a specific entry from the 'directemail' table */ // connect to the database include('connect-db.php'); // check if the 'id' variable is set in URL, and check that it is valid if (isset($_GET['Rec_ID']) && is_numeric($_GET['Rec_ID'])) { // get id value $Rec_ID = $_GET['Rec_ID']; // delete the entry $result = mysql_query("DELETE FROM directemail WHERE Rec_ID=$Rec_ID") or die(mysql_error()); // redirect back to the view page header("Location: CNTCAdmin.php"); } else // if id isn't set, or isn't valid, redirect back to view page { header("Location: CNTCAdmin.php"); } ?> The error message reads: "Warning: Cannot modify header information - headers already sent by (output started at /home/heartl20/public_html/admin/CNTCAdmin-delete.php:2) in /home/heartl20/public_html/admin/CNTCAdmin-delete.php on line 22" NOTE: It does delete the record. It just doesn't go back to the CNTCAdmin.php page which is my "View" page. Any help would be most appreciated. Thanks, Hal Quote Link to comment Share on other sites More sharing options...
falkencreative Posted January 4, 2012 Report Share Posted January 4, 2012 Check to make sure you don't have any empty/space characters or new lines at the start of the file before the <?php. That error indicates that the script has displayed something to the browser (usually white space) and due to that, the header() redirect won't work. Quote Link to comment Share on other sites More sharing options...
HalRau Posted January 4, 2012 Author Report Share Posted January 4, 2012 Thank you. There was some white space, (line breaks) at the end, before the ?> end. None at the beginning but I had added some security code at the top of the page and that may have eliminated it. Thanks again for your help and a great set of scripts. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.