Hi everyone, I don’t post much because I like to search first, well I have searched (google and here), and bothered Omega and have gotten stuck (heck Omega is the reason I’m THIS far…he did a lot of what you will see on the script itself ~thanks Omega!) anyway, basically I’m making a feedback form that has an admin area where the admin can view the comments and delete them when he/she is done.
Right now I have the script that makes the comments and the ability to view them, but I can’t figure out the delete. Thus far the best I have come up with is this:
[code=php]
if (isset ($_POST[‘submit’])) { // Handle form.
if(empty( $_POST[“delete”])) {
echo “Please enter the id of the message you wish to delete.<br />”;
} else {
$data = “feedback.xml”; //the file that it works with
$string = file($data); // turn the file into the string
// I believe this line is my problem: what it is supposed to be is $to_delete uses a regular expression to match:
//<entry>
// <number>[the id of the to-be-deleted post AKA $delete]</number>
// <name>[a word]</name>
// <email>[a word]</email>
// <message>[words]</message>
//</entry>
$to_delete= “/<entry>t<number>$delete</number>nt<w+>w*</w+>nt<w+>w*</w+>nt<w+>w*</w+></entry>/”;
$replacement = “”; // what it will be replaced with (nothing)
preg_replace($to_delete, $replacement, $string);
} //end else
}//end handling the form
//I also don’t know how to then write this to the file, or if, by using preg_replace it IS being written to the file….
If you want to see it all you can go [URL=http://literside.net/test/feedback/admin.php]the page
Thanks ahead of time for all your help ?