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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:08:50+00:00 2026-06-04T05:08:50+00:00

I have a list of checkboxes on a form, which updates the user’s status.

  • 0

I have a list of checkboxes on a form, which updates the user’s status.
I want to do like, when new users are selected in the checkbox, then they get inserted in DB, otherwise, if something is unchecked, but it is active in the database, then it should be deactivated.

I adopted:
I took 2 arrays, first from database, where I get which users are active.
And second from the submitted form, which values are checked, but don’t know how I will calculate that which data to be inserted and which one should be made inactive?

  • 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-04T05:08:51+00:00Added an answer on June 4, 2026 at 5:08 am

    Loop through the ones in the database and if they are not checked by the user then remove them.

    foreach ($from_db as $in_db) {
        if ( ! in_array($in_db, $from_user) {
            // TODO: remove $in_db from db
        }
    }
    

    Then loop through the ones checked by the user and if they are not in the database add them.

    foreach ($from_user as $add_to_db) {
        if ( ! in_array($add_to_db, $from_db) {
            // TODO: add $add_to_db to db
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form which contains list of data, I added a checkbox in
I have a simple user signup form with a checkbox that lets users get
I have a list of checkboxes like you would see in most email clients
I have a list of checkboxes in a table like this along with a
I have a list a simple dialog box which contains a few checkboxes, I
I have List I want to sort Desc by Priority, which is int and
I have a form which have many check boxes in it. User will check
I'm a tad confused. I have a Repeater which populates a list of Checkbox
I have an ASP.NET MVC view which contains checkboxes for user-defined categories. <td><% foreach
I have a listview which is filled with data form sqlitedatabase. A list-view element

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.