Use the IN clause
Put the checkbox values into an array - validate them and then:
SELECT SUM(fieldname) AS total FROM tablename WHERE ref_no IN ($array);
If you need to validate many values in an array, have a look at functions such as array_map() - they'll save you writing loops.
diafol
Keep Smiling
10,665 posts since Oct 2006
Reputation Points: 1,628
Solved Threads: 1,513
Skill Endorsements: 57