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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:25:03+00:00 2026-05-28T07:25:03+00:00

Good evening guys, I’m trying to pass multiple checkbox values through AJAX and process

  • 0

Good evening guys,

I’m trying to pass multiple checkbox values through AJAX and process them with a external .php script. Goal: delete multiple rows using checkboxes without refreshing the page.

Please assist me with passing the selected checkboxes into the datastring and putting them in the mysql command in the external .php file. This is the code so far:

The checkboxes:

<form name="frmMain" id="myForm" method="post" OnSubmit="return onDelete();">


<input class="checkbox_button_del" type="submit" id="buttondel" value="Delete" /> // submit to ajax


<input type="checkbox" class="cb-element" name="chkDel[]" id="chkDel<?=$i;?>" value="' .($id). '">


<input type="hidden" name="hdnCount" value="<?=$i;?>">
</form>

The AJAX:

$(function () {
    $(".checkbox_button_del").click(function () {
        var id = $(this).attr("id");
        var dataString = 'id=' + id; //pass checkbox ids somehow
        var parent = $(this).parents('tr:first');


        $.ajax({
            type: "POST",
            url: "core/actions/delete_multiple.php",
            data: dataString,
            cache: false,

            success: function () {
                parent.fadeOut('300', function () {
                    $(this).remove();
                });
                $("#display").load("display.php")

            }
        });

        return false;
    });
});   

The delete script:

// receive checkbox ids from ajax and delete rows

    for($i=0;$i<count($_POST["chkDel"]);$i++)
    {
        if($_POST["chkDel"][$i] != "")
        {
            $strSQL = "DELETE FROM players ";
            $strSQL .="WHERE id = '".$_POST["chkDel"][$i]."' ";
            $objQuery = mysql_query($strSQL);
        }
    }
  • 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-28T07:25:04+00:00Added an answer on May 28, 2026 at 7:25 am

    You can do this by putting all the checkboxes in a form. And then add the following line in your function:

    datastring = $('#myform').serialize();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good evening guys, how can I run a piece of jQuery/ajax when a certain
Good evening, I made a well working function with php, mysql and ajax. A
Good evening, I am in the process of writing a Java Servlet (Struts 2,
Hi and good evening, hope someone can help. I am trying to get some
Good evening, In a test JSF 2.0 web app, I am trying to get
Good evening, I am having a weird issue with a method I am trying
Good evening all, I'm trying to write a method that creates and returns a
Good evening, here is what I am trying to achieve, I currently have a
Good evening all, I'm trying to implement jquery table sorter, all seems fine and
Good evening, people! I'm trying to solve a rather simple problem, but.. well, it

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.