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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:53:33+00:00 2026-06-01T18:53:33+00:00

Below code !Gives me check boxes and a delete button, In input tag all

  • 0

Below code !Gives me check boxes and a delete button, In input tag all check box have same name (check)!! There check box can be retreive from database with id .

Problem Is:: when I am selecting multiple checkbox for deletion…only last one checkbox is deleted ! means it can delete 1 data from a database.

url like -> http://localhost/demo/delete.php?check=10&check=13&check=14&submit=Delete

I need while I am selecting a checkbox more than 1 checkbox ,check box datas is deleted from database ! Any one help me to overcome this problem thanks

  1. index.php

    <?php
    $sql = mysql_connect('localhost', 'root', '');
    mysql_select_db('database_section', $sql);
    ?>
    <form name="checkbox" method="get" action="delete.php">
        <table>
            <tr>
                <?php
                $sql = "select * from data";
                $result = mysql_query($sql) or die(mysql_error());
                while ($row = mysql_fetch_array($result))
                {
                    ?>
                    <td><input type="checkbox" name="check" value="<?php echo $row['id']?>"><?php echo      $row['data'];?>
                    </td>
                    <?php
                }
                ?>
            <tr>
                <td><input type="submit" name="submit" value="Delete"></td>
            </tr>
        </table>
    </form>
    
  2. Now, In delete.php..code below…

    <?php
    $sql = mysql_connect('localhost', 'root', '');
    mysql_select_db('database_section', $sql);
    if ($_REQUEST['submit']) {
        $abc = $_GET['check'];
        $sql = "Delete from data where id=$abc";
        $result = mysql_query($sql) or die(mysql_error());
        if (isset($result)) {
            echo "data deleted";
        }
        else
        {
            echo "not possible";
        }
    
    }
    ?>
    
  • 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-06-01T18:53:35+00:00Added an answer on June 1, 2026 at 6:53 pm

    Use check box as an array holder. name it as check[] to hold all selected values. And on post you will get the selected array list.

    Now your $abc will be a array, use foreach in delete.php to get the checked ids.

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

Sidebar

Related Questions

The code below adds totals of check boxes and gives a discount if ALL
I have a file input known as 'name=fileImage'. Now I have php code below
I have a code like this below, which gives me a $link that equals
Possible Duplicate: CodeIgniter Disallowed Key Characters When I check all the checkboxes (code below)
In the C++ code below, the templated Check function gives an output that is
This code below gives me this error: You have an error in your SQL
Executing the below code gives me the following exception on the last line: InvalidOperationException:
the code below gives compilation error when I try to create test t[2]; because
The code below gives me the following error: incompatible types when assigning to type'char[10]'
I'm attempting to convert a string to a TStream. My code below gives me

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.