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 6933511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:50:30+00:00 2026-05-27T11:50:30+00:00

I am having a very hard time solving my problem with the multiple checkbox

  • 0

I am having a very hard time solving my problem with the multiple checkbox delete. Can someone direct me to the solution? What is supposed to happen here is that the user can tick the boxes and click a delete button to delete the ticked ones. Unfortunately, my code doesn’t seem to work; can you point me in the right direction?

<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="videoContainer" class="page">
            <video id="video" 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="displayOpacity">
                            <input type="text" name="display" id="display" value="0" />
                        </div>
                        <input type="submit" value="Delete" name="btnDelete" id="btnDelete" />


        </div>
        <div id="postItDiv" class="page">
            <?php
                $cxn = mysqli_connect('localhost','root','root','TimePost')  or die(mysqli_error());
                $selectQuery = "SELECT PostID, ClientName, VideoName, PostTime, Post, Date FROM tblTimePosts";
                $selectResult = mysqli_query($cxn,$selectQuery) or die(mysqli_error());
                while($row = mysqli_fetch_assoc($selectResult)) 
                {
                    $postz = $row['Post'];
                    $timez = $row['PostTime'];
                    $idNoz = $row['PostID'];
                    echo '<div id="post1"><p class="postParagraph">Post ID No.'.$idNoz.'<br />'.$postz.' at '.$timez.' seconds mark</p><input type="checkbox" name="checkbox[]" id="checkbox[]" value="'.$idNoz.'"</input></div>';
                }
            if ($_POST['btnPost'] == "Post") {

                $toPost = $_POST['textPost'];
                $date = date("y-m-d");
                $postTime = $_POST['display'];
                $postTime = floor($postTime);

                $insertQuery = "INSERT INTO tblTimePosts VALUES ('','Mimagazine Asia','Chelsea','$postTime','$toPost','$date')";
                $insertResult = mysqli_query($cxn,$insertQuery) 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'];
                    echo '<div id="post1"><p class="postParagraph">Post ID No.'.$idNo.'<br />'.$post.' at '.$time.' seconds mark</p><input type="checkbox" name="checkbox[]" id="checkbox[]" value="'.$idNo.'"</input></div>';
                }
            }
            else if($_POST['btnDelete'] == "Delete")
            {
               $tbl_name = 'tblTimePosts';
               foreach ($_POST['checkbox'] as $id => $value) 
               {
                  $sql = 'DELETE FROM `'.$tbl_name.'` WHERE `PostID`='.(int)$id;
                  $resulta = mysqli_query($cxn,$sql);
                  if ($resulta > 0) {
                                echo "success";
                            }
                            else
                                echo "fail";
                        }
                        header('Location: videoJudge.php'); 
                 }
            ?>
            </form>
        </div>

            <span id="copyright" class="page">Copyright © 2011<span style="color:#00AEEF;">mi</span>magazine.asia</span>
            <span id="comment" class="page" style="color:#00AEEF;">comment/s</span>
            <span id="download" class="page">(Right-click to download video)</span>
    </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-27T11:50:30+00:00Added an answer on May 27, 2026 at 11:50 am

    This HTML:

    echo '<div id="post1"><p class="postParagraph">Post ID No.'.$idNoz.'<br />'.$postz.' at '.$timez.' seconds mark</p><input type="checkbox" name="checkbox[]" id="checkbox[]" value="'.$idNoz.'"</input></div>';
    

    should be:

    echo '<div id="post1"><p class="postParagraph">Post ID No.'.$idNoz.'<br />'.$postz.' at '.$timez.' seconds mark</p><input type="checkbox" name="checkbox[]" id="checkbox[]" value="'.$idNoz.'" /></div>';
    

    This query on else if($_POST['btnDelete'] == "Delete") should be:

    $sql = 'DELETE FROM `'.$tbl_name.'` WHERE `PostID`='.(int)$value;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a very hard time wrapping my head around this problem (it might
I am having a very hard time finding a standard pattern / best practice
I've been having a very hard time finding good examples of UIScrollView. Even Apple's
i am very new to Adobe Air and i am having a hard time
I'm having a very hard time getting the 2 buttons in the 2nd child
I am having a very hard time finding resources that talk about the windows
I'm having a very hard time trying to do something very simple. Here's the
I'm having a very hard time dealing with multipart/form-data requests with my java application
I'm having a very hard time trying to access a custom configuration section in
I'm having a very hard time at trying to do trivial things with Visual-generated

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.