Sticky checkboxes driving MySQL Query on PHP Form

I need to have a form with "sticky" checkboxes that submit the form when one of the checkboxes is changed and stay checked or unchecked after the change.  When the form submits, it needs to send post the form and drive the refresh of the form data.
TimothyPowellAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
This is such a common question that we have an article about it here at EE!
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_5450-Common-Sense-Examples-Using-Checkboxes-with-HTML-JavaScript-and-PHP.html

Please read that over and post back with any specific questions.  The part about persisting the client response in the database is really a matter of keeping a data model of the checkboxes in the database.  When the client submits the checkbox collection, you clear all of the database entries and set all of the checkboxes that are active in the request.  When the server prepares the web page, it creates all of the checkboxes, then marks "checked" any of the checkboxes that are set in the data base model.
0
Chris StanyonWebDevCommented:
You're gonna need to introduce some javascript here to react to the checkboxes changing. It's then up to you to decide how you submit the form - you could do it in the traditional way, or the more modern approach, which is to send the form data back the server using an AJX request.

Doing it with an AJAX request means that your checkboxes would remain sticky as the user never navigates away from your page.

As for refreshing the form data - your AJAX request could pull in the new data and populate the form, again without ever having to navigate away from the page.

Can't really give you specific details with specific requirements, but the easiest way to implement an AJAX based for is to use the jQuery library.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.