Your html form is sent whatever happens.
If the user has JS turned on then your JS must check the return value of the confirm box and then submit your form programmatically.
If JS is turned off, your form should ideally submit regardless, except the double check with the confirm box will not have appeared.
If that is what you want, you are facing a JS coding problem - little/nothing to do with PHP at all.
You can do similar just using PHP and not relying on JS: Send an extra request to the server.
1 Form showing a delete button:
submits to a page which asks:
2 Are you sure you want to delete?
submits to a page which:
3 Deletes the record, then shows a helpful message or re-routes back into the workflow at the appropriate place.
There is probably another way to do this using Ajax.