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

The Archive Base Latest Questions

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

How to Save value of check-box within 5 columns to database (PHP and JQUERY)

  • 0

How to Save value of check-box within 5 columns to database (PHP and JQUERY) ?

PHP code are dispay 6 columns. there 5 columns contain check-box that loop from database.

—PHP———————————–

        <table  id="tblISP" border="0">         
    <tr>
        <th style="width:20px">
        </th>
        <th>
            MenuID
        </th>

        <th>
            Menu
        </th>
        <th>
            Delete
        </th>
        <th>
            Upddate
        </th>
        <th>
            View
        </th>
        <th>
            Save
        </th>
    </tr>
    <tr>
        <td>ALL <input type="checkbox" class="menuiddd" name="checkmenuid" id="checkmenuid"/></td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>ALL<input type="checkbox" class="menuidddel" name="checkdelete" id="checkdelete"/></td>
        <td>ALL<input type="checkbox" class="menuiddupdate" name="checkupdate" id="checkupdate"/></td>
        <td>ALL<input type="checkbox" class="menuiddview" name="checkview" id="checkview"/></td>
        <td>ALL<input type="checkbox" class="menuiddsave" name="checksave" id="checksave"/></td>
    </tr>
                        <tr>
        <td>

                <input type="checkbox" class="menuiddd" name="idd[]" id="idd[]" value="<?php echo $row["mid"]; ?>"/>
        </td>
        <td>
            <?php echo $row["mid"]; ?>
        </td>
        <td>
            <?php echo $row["mname"]; ?>
        </td>    
        <td>
            <input type="checkbox" class="menuidddel" name="del[]" id="del[]" value="chkdel" />
        </td>
        <td>
            <input type="checkbox" class="menuiddupdate" name="upd[]" id="upd[]" value="chkupd" />
        </td>
        <td>
            <input type="checkbox" class="menuiddview"  name="vie[]" id="vie[]" value="chkvie" />
        </td>
        <td>
            <input type="checkbox" class="menuiddsave" name="sav[]" id="sav[]" value="chksav" />
        </td>
    </tr>

        <tr>
        <td colspan="3">
            <!--<a id="hlsa" href="javascript:exit(0);">Select All</a>
            <a id="hldsa" href="javascript:exit(0);">DeSelect All</a>-->
        </td>
    </tr>
    <tr>
        <td colspan="3" align="center">
            <hr/>
            <input type="button" value="Save" id="btSave" name="btSave" style="cursor:pointer;float:none" class="allbutton">
        </td>
    </tr>
    <tr>
        <td colspan="3"  id="dvProc1" align="center">

        </td>
    </tr>
    </table>Save check-box value within 5 columns to database

——————Jquery————

Jquery reaction when click button save then get information from check box save to database.

$(document).ready(function (){

            $("#btSave").unbind();
            $("#btSave").click(function(){          

                var idd = [];
                var del = [];
                var upd = [];
                var vie = [];
                var sav = [];

                $("input[name='idd[]']:checked").each(function() {
                  idd.push($(this).val());
                });

                $("input[name='del[]']:checked").each(function() {
                  del.push($(this).val());
                });

                $("input[name='upd[]']:checked").each(function() {
                  upd.push($(this).val());
                });

                $("input[name='vie[]']:checked").each(function() {
                  vie.push($(this).val());
                });

                $("input[name='sav[]']:checked").each(function() {
                  sav.push($(this).val());
                });


                var mainarray=[idd,del,upd,vie,sav];
                var transposed = mainarray.transpose();

                //-----------------------alert(str);--note--need return-------------
                alert(transposed.join(';'));

            })


            $("#checkmenuid").click(function(){
                $('.menuiddd').attr('checked', $( this ).is( ':checked' ) ? 'checked' : "");
            });


            $("#checkdelete").click(function(){
                $('.menuidddel').attr('checked', $( this ).is( ':checked' ) ? 'checked' : "");
            });

            $("#checkupdate").click(function(){
                $('.menuiddupdate').attr('checked', $( this ).is( ':checked' ) ? 'checked' : "");
            });


            $("#checkview").click(function(){
                $('.menuiddview').attr('checked', $( this ).is( ':checked' ) ? 'checked' : "");
            });


            $("#checksave").click(function(){
                $('.menuiddsave').attr('checked', $( this ).is( ':checked' ) ? 'checked' : "");
            });

});

</script>
  • 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-27T09:50:55+00:00Added an answer on May 27, 2026 at 9:50 am

    I’m not entirely sure I’ve identified your question, but before you deal with any jQuery you should build a functioning system without any javascript. Rather than defining a non-standard method for dealing with the form’s submission, you can simply write it normally before adding a clean layer of javascript to handle asynchronous submission.

    Firstly, you need to wrap your input elements in a form element, and then write a PHP script to analyse the global $_POST array and to execute the various database commands as required. You can use this PHP layer for the logic of identifying what calls should be made to the database, based on what the user has selected on the form. Note that checkboxes that are unchecked are not actually sent in the POST request, so you’ll have to use isset() in PHP to know if they were unchecked.

    Once that’s arranged, you can use jQuery to submit the form asynchronously, and you won’t cause a page refresh:

    $(function() {
        $('form#yourformid').submit(function(event) {
            event.preventDefault(); // stop the page from redirecting
    
            // serialise your form's data, and send it in a POST request
            // to the form's action attribute
            $.post(
                $(this).attr('action'),
                $(this).serialize(),
                function() {
                    alert('Data successfully saved.');
                });
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the following code to save values from a settings view that
i have many textbox and check box on my wpf . how to save
im bit confused how to save checkbox value dynamically in 1 table! database: id
I have a form that save a question and five answers in the database
Why when I save a value of say 40.54 in SQL Server to a
In WPF, where can I save a value when in one UserControl, then later
Hi I am trying to use NSUserDefaults to save some default values in database.
Save one image path in the database... and whenever a call is made to
Problem Detail: In itemCheckout.ftl (freemarker template) I have a drop-down box with check-box associated
i want to store the value of a checkbox into my sql database, basically

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.