dataAssist delete multiple records
on my results page i would like to add a colomn with check boxes for multiple delete are there tutorials how to do this
on my results page i would like to add a colomn with check boxes for multiple delete are there tutorials how to do this
Hi Randy,
The best way to do that would be to add a single checkbox inside the dynamic loop, but give it a name like : name="deletfile[]"
By using the brackets, it will signify the Post Value which I arbitrarily chose the name "deletefile" to become an array storing all the values.
Next, make the checked value equal to the ID of the item.
You will then need to wrap you entire table into a form tag. Set the method to post and I would make the action go to a separate page in this case to process the deletion. Create a page called deletefiles.php for example and then set the action in your form to deletefiles.php.
Somewhere before your closing form tag, you will need two things: a button to execute the form and also a hidden input with the value set to "MM_Update". The reason I do this is to make sure that the delete process page could never run without the presence of the MM_Update flag in the Post array.
The next thing is to add the code to deletefiles.php. You won't need any html on the page, so if you are using Dreamweaver, you can delete all the automatically generated stuff since this page is simply going to process the deletes and then redirect back to the results page.
Your code on the deleting page will look like this:
<?php
if (isset($_POST["MM_update"])) {
$deletes = $_POST['deletefile'];
foreach ($deletes as $item){
DELETE FROM table WHERE id = $item
}
header('Location: original_results_page.php');
exit;
}
?>
That's it.
Best regards,
Brian
Randy,
As well as Brian's solution there is both a video and pdf tutorial under "solution recipes" on this page.
I used the video myself only yesterday to carry out this very procedure. Worked like a charm.
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
These out-of-the-box solutions provide you proven, tested applications that can be up and running now. Build a store, a gallery, or a web-based email solution.