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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:42:00+00:00 2026-05-26T03:42:00+00:00

Okay, so I have successfully retrieved rows from my db where i have fields

  • 0

Okay, so I have successfully retrieved rows from my db where i have fields :

ref,fname,lname,event1,event2,event3. 
ref is the ID (autonumber).

So in my index php file I retrieve the data from my db and store in a table with appropiate headers and then the 100 names approx I have. For event 1 event 2 and event 3 rows i have checkboxes. Now , I’ve tried for hours to capture the checked checkboxes and update the db record columns for event1 and/or event2 and/or event3. I think my error is when i name the checkboxes, I named for each row:

The event1 checkbox I named event1[]
The event2 checkbox I named event2[]
The event3 checkbox I named event3[]

…and this was repeated a 100 times. When I submit the form, I wrote in the post_submit.php file the following:

$event1[] = $_POST['event1'];
$event2[] = $_POST['event2'];
$event3[] = $_POST['event3'];

Which is apparently wrong as it doesn’t work.

What happens is, when i check some checkboxes and then submit the form, it’s always the first couple of records in my db that gets updated, if i check the LAST checkbox for event1, and i go to my database and it was only the event1 field for the first record which got updated. I’m doing something wrong here, and i’m guessing it’s something to do with the information I have provided above. Can somebody please help. Also, for the checkbox value i have “1” so the idea is to update the event1,2,3 fields with a 1 if it was checked.

Thanks

  • 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-26T03:42:00+00:00Added an answer on May 26, 2026 at 3:42 am

    If I understand correctly, you have a table of about 100 rows with:

    id, first name, last name, event 1, event 2, event 3
    

    and event 1-3 are just checkboxes in the table field.
    If you just have event1[] with value either 1 or 0 (checked or unchecked) and you post this form, the submit screen will just have an array of 0’s and 1’s. It does not keep track of which row it comes from.

    Advise: give your event1-3[] the value of the id. This way your event array will contain the id’s that need the event updated.

    So if you have id = 3, then have the checkbox:

    <input type='checkbox' name='event1[]' value='3'>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay I have this RewriteRule which is supposed to redirect any request for the
Okay I have a large CRUD app that uses tabs with Forms embedded in
Okay I have a series of objects based on a base class which are
okay i have found the way to run a video in a image.... the
Okay I have updated my code quite a bit. I am getting a new
Okay I have updated my code a little, but I am still not exactly
Okay i have two models: posts and comments. as you can think comments has
Okay so I have the following Code which appends a string to another in
Okay so I have a scenario similar to the below code, I have a
Okay so i have a semi weridish problem with re.sub. Take the following code:

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.