Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6940181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:43:11+00:00 2026-05-27T12:43:11+00:00

My implementation doesn’t seem to work. Can you point out what might be the

  • 0

My implementation doesn’t seem to work. Can you point out what might be the problem or point me to a better solution? When I check the checkboxes and click the delete button, it doesn’t seem to do anything… please help me.

<div id="container" class="page">
    <img id="disclaimer" class="page" src="images/DISCLAIMER.png" alt="" />
    <img id="logo" class="page" src="images/MI-LOGO.png" alt="" />
    <div id="postItDiv" class="page">
        <?php
        $cxn = mysqli_connect('localhost', 'root', 'root', 'TimePost') or die(mysqli_error());
        $query = "SELECT PostID, ClientName, VideoName, PostTime, Post, Date FROM tblTimePosts";
        $result = mysqli_query($cxn, $query) or die(mysqli_error());

        while($row = mysqli_fetch_assoc($result)) {
            $post = $row['Post'];
            $time = $row['PostTime'];
            $idNo = $row['PostID'];
            $postColor = rand(1, 4);
            echo '<div id="post1"><p class="postParagraph">Post ID No.' . $idNo . '<br />' . $post . ' at ' . $time . ' seconds mark</p><div class="close"><form method="POST" action="videoJudge.php"><input type="checkbox" name="checkbox[]" id="checkbox[]" value="' . $idNo . '" /></form></div></div>';
        }

        if($_SERVER['REQUEST_METHOD'] == "POST" && $_POST['btnPost']) {
            $postColors = rand(1, 4);
            $toPost = $_POST['textPost'];
            $date = date("y-m-d");
            $postTime = $_POST['display'];
            $postTime = floor($postTime);
            $insertPostQuery = "INSERT INTO tblTimePosts VALUES('','Mimagazine Asia','Chelsea','$postTime','$toPost','$date')";
            $query3 = "SELECT PostID FROM tblTimePosts";

            $result = mysqli_query($cxn, $insertPostQuery) or die(mysqli_error());
            $result3 = mysqli_query($cxn, $query3) or die(mysqli_error());
            if($result > 0) {
                while($row = mysqli_fetch_assoc($result3)) {
                    $idNo2 = $row['PostID'];
                }
                echo '<div id="post1"><p class="postParagraph">Post ID No.' . $idNo2 . '<br />' . $toPost . ' at ' . $postTime . ' seconds mark</p><div class="close"><form method="POST" action="videoJudge.php"><input type="checkbox" name="checkbox[]" id="checkbox[]" value="' . $idNo2 . '" /></form></div></div>';
            }
            else
                echo "Add Failed";
        }

        /* if($_POST['chkDelete']) {
            for($i=0;$i<5;$i++){
                $del_id = $checkDelete[$i];
                $sql = "DELETE FROM $tblTimePosts WHERE PostID='$del_id'";
                $resulta = mysqli_query($cxn,$sql);
            }
        } */

        if($_POST['btnDelete']) { // from button name="delete"
            /* $checkbox = $_POST['checkbox']; //from name="checkbox[]"
            $countCheck = count($_POST['checkbox']);
            echo $countCheck;
            for($i=0;$i<$countCheck;$i++){
                $del_id = $checkbox[$i];
                $sql = "DELETE FROM tblTimePosts WHERE PostID=".$del_id."";
                $resulta = mysqli_query($cxn,$sql) or die(mysqli_error());
            } */

            $tbl_name = 'tblTimePosts';
            foreach($_POST['checkbox'] as $id => $value) {
                $sql = 'DELETE FROM `' . $tbl_name . '` WHERE `PostID`=' . (int) $id;
                mysqli_query($cxn, $sql);
            }
            header('Location: videoJudge.php');
        }
        ?>
    </div>
    <div id="videoContainer" class="page">
        <video id="video" poster="images/cover.png" controls>
            <source src="video/animationTest.m4v" />
        </video>
    </div>
    <div id="etc" class="page">
        <form action="<?php $_SERVER['PHP_SELF'] ?>" method="POST">
            <textarea name="textPost" id="textPost"> 
            </textarea>
            <input type="submit" name="btnPost" id="btnPost" value="Post" />
            <div id="tae">
                <input type="text" name="display" id="display" value="0" />
            </div>
        </form>
    </div>
    <div id="delButtonDiv">
        <form action="<?php $_SERVER['PHP_SELF'] ?>" method="POST">
            <input type="submit" value="Delete" name="btnDelete" />
        </form>
    </div>
</div>

HERE IS MY CODE NOW AFTER FOLLOWING ALL YOUR COMMENTS BUT STILL DIDNT WORK. 🙁

<?php
            $cxn = mysqli_connect('localhost','root','root','TimePost') or die(mysqli_error());
            $query = "SELECT PostID, ClientName, VideoName, PostTime, Post, Date FROM tblTimePosts";
            $result = mysqli_query($cxn,$query) or die(mysqli_error());
            while($row = mysqli_fetch_assoc($result)) {
                $post = $row['Post'];
                $time = $row['PostTime'];
                $idNo = $row['PostID'];
                $postColor = rand(1,4);
                echo '<div id="post1"><p class="postParagraph">Post ID No.'.$idNo.'<br />'.$post.' at '.$time.' seconds mark</p><div class="close"><form method="POST" action="videoJudge.php"><input type="checkbox" name="checkbox[]" id="checkbox[]" value="'.$idNo.'" /></form>     
                </div></div>';
            }
             if ($_SERVER['REQUEST_METHOD'] == "POST" && $_POST['btnPost']) {
                $toPost = $_POST['textPost'];
                $date = date("y-m-d");
                $postTime = $_POST['display'];
                $postTime = floor($postTime);
                $insertPostQuery = "INSERT INTO tblTimePosts VALUES('','Mimagazine Asia','Chelsea','$postTime','$toPost','$date')";
                $query3 = "SELECT PostID FROM tblTimePosts";

                $result = mysqli_query($cxn, $insertPostQuery) or die(mysqli_error());
                $result3 = mysqli_query($cxn, $query3) or die(mysqli_error());
                if ($result > 0) {
                    while($row = mysqli_fetch_assoc($result3)) {
                        $idNo2 = $row['PostID'];
                    }
                    echo '<div id="post1"><p class="postParagraph">Post ID No.'.$idNo2.'<br />'.$toPost.' at '.$postTime.' seconds mark</p><div class="close"><form method="POST" action="videoJudge.php"><input type="checkbox" name="checkbox[]" id="checkbox[]" value="'.$idNo2.'"
                    /></form></div></div>';
                }
                else
                    echo "Add Failed";
            }
            if($_POST['btnDelete'] == "Delete")
             {
                 $tbl_name = 'tblTimePosts';
                    foreach ($_POST['checkbox'] as $id => $value) 
                    {
                        $sql = 'DELETE FROM `'.$tbl_name.'` WHERE `PostID`='.(int)$id;
                        mysqli_query($cxn,$sql);
                    }
                    header('Location: videoJudge.php'); 
             }
        ?>
        </div>
        <div id="videoContainer" class="page">
            <video id="video" poster="images/cover.png" controls>
                <source src="video/animationTest.m4v" />
            </video>
        </div>
        <div id="etc" class="page">
            <form action="<?php echo $_SERVER['PHP_SELF']?>" method="POST">
                    <textarea name="textPost" id="textPost"> 
                    </textarea>
                        <input type="submit" name="btnPost" id="btnPost" value="Post" />
                        <div id="tae">
                            <input type="text" name="display" id="display" value="0" />
                        </div>

                <div id="delButtonDiv">
                <input type="submit" value="Delete" name="btnDelete" />
                </div>
            </form>
        </div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:43:12+00:00Added an answer on May 27, 2026 at 12:43 pm

    Doing this should solve the problem, try:

    <div id="etc" class="page">
        <form action="<?php $_SERVER['PHP_SELF']?>" method="POST">
            <textarea name="textPost" id="textPost"></textarea>
            <input type="submit" name="btnPost" id="btnPost" value="Post" />
            <div id="tae">
               <input type="text" name="display" id="display" value="0" />
            </div>
    
            <!-- END FORM REMOVED HERE -->
    
            <!-- FORM REMOVED HERE -->
    
         <div id="delButtonDiv"> <input type="submit" value="Delete" name="btnDelete" /> </div>
       </form>
    </div>
    

    [EDITED]

    You have two submit button in your form, then you need to know what exactly action you are taking, POST or DELETE, right? then you can create an basic controller to your post in your own php script, something like this:

    Here is the form -> <form action="<?php $_SERVER['PHP_SELF']?>" method="POST">

    and here are the submit buttons

    <input type="submit" name="btnPost" id="btnPost" value="Post" />
    <input type="submit" value="Delete" name="btnDelete" />
    

    $_SERVER['PHP_SELF'] tells you that it will send the form data to itself, if so, then do something like this in the begin of your script:

    if ($_POST[btnPost] == "Post") 
    // do some action to post the data
    
    if ($_POST[btnDelete] == "Delete") 
    // do some action to delete the data
    

    clear now?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

the e4x implementation in as3 doesn't seem to be able to handle node names
There doesn't appear to be a generic implementation of OrderedDictionary (which is in the
So, right now, I just pass a pointer to a Queue object (implementation doesn't
I wrote a WCF service, but the data stored in the Service implementation doesn't
I have a problem with the Google App Engine JDO implementation that I cannot
I just read Is there a no-duplicate List implementation out there? answer about a
It seems that LynxOS's implementation of strtod doesn't handle all the same cases as
I made my own implementation of strlen in assembly, but it doesn't return the
Why this generic interface implementation doesn't complile? //The type Client<T> must implement the inherited
and why does Implementation ID necessary in ECOM? UID3 is not enough? thank you.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.