mardi 30 mai 2017

PHP Delete Confirmation Won't Appear

I have a script for deleting a row in table where it needs an id to specify which row to delete:`

function hapus(delid) {
    var r = confirm("Are you sure you want to delete " +delid+ "?");
    if (r == true) {
        window.location.href='hapus_jeniskompetensi.php?del_id=' +delid+'';
    }
}`

and I called it in:

<input type="button" onClick="hapus(<?php echo $row['id_jeniskompetensi'];?>)" name="Delete" value="Delete">

It doesn't work. The confirmation box won't appear. If I called it without passing the parameter (just onClick="hapus()") the confirmation box will appear, but of course the delete function will fail. Am I missing something here?

Here's my full code: admin.php

And the delete code: hapus_jeniskompetensi.php

Thanks in advance!!




Aucun commentaire:

Enregistrer un commentaire