1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: php mysql update corresponding records

Discussion in 'Web Design & Development' started by twmprys, Apr 28, 2010.

Thread Status:
Not open for further replies.
Advertisement
  1. twmprys

    twmprys Thread Starter

    Joined:
    Jun 4, 2009
    Messages:
    111
    Hope somebody can help. I've spent ages trying to work out how FOR or FOREACH could help in this, but I can't figure out the exact process. I have a form which includes a WHILE loop listing members from a database with checkboxes. When the form is SUBMITTED I want those members with checked boxes to be recorded as such.

    These are the two fields being POSTED:

    PHP:
    $_POST['seniormember'];
    $_POST['id'];
    The 'seniormember' is the checkbox. The idea is those who have been CHECKED become senior members.
    Could somebody nudge me in the right direction?
     
  2. MMJ

    MMJ Guest

    Joined:
    Oct 15, 2006
    Messages:
    3,625
  3. twmprys

    twmprys Thread Starter

    Joined:
    Jun 4, 2009
    Messages:
    111
    Thanks. Combining that simple lesson with FOREACH half solved my problem. I can get the database to record new checks. Now I have to work out how to cancel unchecked rows.
     
  4. twmprys

    twmprys Thread Starter

    Joined:
    Jun 4, 2009
    Messages:
    111
    My complete solution is this: run a query through the database clearing all the checked fields, then run a FOREACH loop to populate just the fields that need to be checked. A bit brutal, but it works.
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/919759

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice