Time for action – deleting data

Actions normally come with some data posted. In the case of the delete action, this data is a list of items that need to be deleted. Let's look at this action with regards to the enhanced information data:

function form_delete() { /* loop through each of the selected tasks and delete them */ while (list($var,$val) = each($_POST)) { // Check $var for the number part and store the number in // the matches array if (ereg("^chk_([0-9]+)$", $var, $matches)) { /* ================= input validation =============== */ input_validate_input_number($matches[1]); /* ================================================== */ db_execute(" DELETE FROM `plugin_cbEnhancedInfo_dataTable` WHERE `Id`='" . $matches[1] . "'" ); } } // when ...

Get Cacti 0.8 Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.