I have a button that delete all the records in a table in a database
<button name="delete-all" class="alert alert-danger delete-all" ><i class="fa fa-close"></i>Delete All</button>
I want when it's clicked a confirmation dialog appears and if it's confirmed this happen :
$state = $connect->prepare("DELETE *  FROM data ");
$state->execute();
// Then a success message appears at the top of the page 
        echo '<div class="container alert alert-success" role="alert">Well done!  You  successfully  Deleted All Records</div>'; 
How to do that because when I insert a php script inside confirmation function An error occur :
unexpected <
<script>
  //confirmation function(){
         <?php
               echo '<div class="container alert alert-success" 
               role="alert">Well done!  You  successfully  Deleted All 
                Records</div>'; 
         ?>
  }
</script>
 
    