Checkboxes

Sorry if this has been posted before… Just link me to it and I’ll be fine.

Righty, say I have something like this:
[link to thing] [checkbox]
[link to thing] [checkbox]
And there was a link at the bottom saying ‘delete selected’ or some other event. Which I do, but I can’t think of a way of getting the ‘delete selected’ to check which boxes are selected and delete the relevant things.

The number of [link to thing]s is dynamic, so I can’t have the checkboxes called a number, and it won’t necessarily be 1, 2, 3 etc, i.e, it could be 5, 10, 13.

Loads of CMS type things (including phpMyAdmin) have something like this, if you don’t understand what I mean.