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,677 posts since Oct 2006
Reputation Points: 1,632
Solved Threads: 1,514
Skill Endorsements: 57