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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:14:11+00:00 2026-06-06T20:14:11+00:00

I want to select multiple rows from checkbox and want to update them all

  • 0

I want to select multiple rows from checkbox and want to update them all at once by button click..I tried in several ways..but not work..can you give a help please? it shows an error as Undefined index: checkbox

<td>
    <input type="hidden" name="id" id="id" value="<?php echo $row["file_serial_id"]; ?>" />
    <input type="checkbox" name="checkbox[]" id="checkbox[]"  value="<?php echo $row['file_serial_id']?>" />
</td>

if(isset($_POST['send_btn']) and $_POST['send_btn']=="Send"){
    $checkbox = $_POST['checkbox']; //from name="checkbox[]"
    $countCheck = count($_POST['checkbox']);

    for($i=0;$i<$countCheck;$i++){
        $del_id = $checkbox[$i];
        $sql2 = "UPDATE retained_file_mst SET mark_to_dispose=1 WHERE file_serial_id='$del_id'";
        $result2 = mysql_query($sql2,$conn);
    }

    // if successful redirect to delete_multiple.php
    if($result2){
        echo "success";
    }else{
        echo "error";
    }
}
  • 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-06T20:14:14+00:00Added an answer on June 6, 2026 at 8:14 pm

    You can access your checkboxes like so:

    $checkbox = isset($_POST['checkbox']) ? $_POST['checkbox'] : 0;
    

    This allows you to set it to the correct value if the user entered it and set it to 0 if the user did not check it.

    Another alternative would be to set it 0 which may be more space conservative for things like databases.

    Edit

    Since you are actually using it as an array this would be better:

    $checkbox = isset($_POST['checkbox']) ? $_POST['checkbox'] : array();
    

    Or just doing a quick if to see if the $checkbox is an array:

    if(is_array($checkbox)){
        // do the for statement
    }
    

    P.S Use code formatting if you want people to understand your question. I have done it for you this time

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

Sidebar

Related Questions

I want to delete rows from multiple tables. I know the select query, but
I want to select rows from multiple tables using subsonic. For one table I
I want to select all rows from my database where the id is equal
I want to update multiple rows based on a SELECT sql query. I want
I have I datagrid, on which I want to select multiple rows on a
I want to make a view where I can select multiple items from listview
I want to get possibility to select several Categories for one Post with multiple
I want to return multiple rows from stored procedure in oracle.How will i do
I want to delete multiple users from db table with checkboxes at once. But
I'm trying to grab multiple rows from SQL Server and then manipulate them in

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.