Hi,
I tried to delete an entry when I click custom button in HTML field, But it didnt work.
Anything wrong with this snippet?
In html, button name is "submit"
// php section
$entry_id = '100';
if (isset($_POST['submit'])) {
FrmEntry::destroy($entry_id);
}
That is actually entry id. I just edit it. Thanks.
If you have that code in an HTML field on the form, it will never execute because it's PHP code. PHP code only executes on the server. If you want a custom button on a form to trigger a delete action, you have to use the button to instantiate an AJAX REQUEST to ask the server to run FrmEntry::destroy($entry_id). This means you have to build the jQuery and PHP callback function to make it all work.
Please login or Register to submit your answer