Form checkboxes to SQL queries
Hi guys,
I've a quick question about passing form variables to a PHP script that interacts with a database (MS Access - don't ask). It's part of a mailing list script, and what I want to do is have "Subject" checkboxes on a form that allow you to send mail from the web to people who have indicated that they want to receive mail about those subjects.
The SQL statement is easy - if I want to mail (say) people who liked Subjects "a" or "b" it'd just be WHERE a=1 OR b=1. I'm running into trouble altering this statement to reflect the boxes that have been ticked on the "Send e-mail" web page though. If I wanted to send mail for subjects "a" and "c" I would tick boxes "a" and "c" on the form, but how would I go about converting this into the a=1 OR c=1 string that I could stick in the SQL query?
I've a quick question about passing form variables to a PHP script that interacts with a database (MS Access - don't ask). It's part of a mailing list script, and what I want to do is have "Subject" checkboxes on a form that allow you to send mail from the web to people who have indicated that they want to receive mail about those subjects.
The SQL statement is easy - if I want to mail (say) people who liked Subjects "a" or "b" it'd just be WHERE a=1 OR b=1. I'm running into trouble altering this statement to reflect the boxes that have been ticked on the "Send e-mail" web page though. If I wanted to send mail for subjects "a" and "c" I would tick boxes "a" and "c" on the form, but how would I go about converting this into the a=1 OR c=1 string that I could stick in the SQL query?
