1
        <?php if(isset($_POST['deleteValues'])){

                    global $wpdb;
                    $table = $wpdb->prefix . 'addkeywords';
                    $where = array( 'id' => $id);
                    $where_format = array( '%d');
                    $deleteTable= $wpdb->delete( $table, $where, $where_format ); 

                    if($deleteTable){
                        echo '<script>alert("Done")</script>';  
                        }else{
                        echo '<script>alert("Not Done")</script>';  
                    }    
                }
                ?>

    <td><form method="post" action=""> 

                <?php if(!empty($_POST['id'])){ ?>


                <?php } else { ?>

                    <button class="btn btn-danger" id="editValues" name="deleteValues">Delete</button>

                <?php } ?>

            </form></td>
  • $where = array( 'id' => $id); Where is $id coming from? – Jacob Peattie Jan 10 at 11:12
  • I am also put static id but it is not working – Get Result Jan 10 at 11:20
  • 1
    Where $deleteTable defined ? – Pratik Patel Jan 10 at 11:25
  • now I define correct all but sitll is not working – Get Result Jan 10 at 20:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.