@Ownersbox - Just create your own increment_counter function that gets the current value, converts to int, adds, and then calls update_post_meta (see above).
And I can't take credit for the idea, Lester 'GaMerZ' Chan uses it in his WP-PostRatings plugin as a counter. It's great for any data that is associated with a particular post that you usually have just one of, like number of views, ratings, or (for my real estate plugin) a listing's price, number of bedrooms, etc.
See http://RogerTheriault.com/listings/ - I use a custom form to present and edit all the data that is displayed there including the map lat and long (and all the pointers to which gallery, panorama, video, etc to show on the detail page).
My plugin isn't public and isn't even fully tested yet. But here are a couple of utility functions I created:
function xtend_updatemeta($postID,$metakey,$single_or_list) {
// permits storing or clearing out of meta from form input,
// will work with multi-select inputs
if (is_array($single_or_list)) {
$commalist = implode(',',$single_or_list); // multiple
} else {
$commalist = $single_or_list; // one or blank
}
if (xtend_getmeta($metakey,$postID)) {
update_post_meta($postID, $metakey, $commalist);
} else {
if ($commalist) // dont add if blank
add_post_meta($postID, $metakey, $commalist);
}
}
function xtend_updatemetafrompost($postID,$metakey) {
// call this when you may have form data to stash away
$postvalue = $_POST[$metakey];
xtend_updatemeta($postID,$metakey,$postvalue);
}
function xtend_getmeta($metakey,$postID = '') {
// call this to grab the data
global $post;
if ($postID == '') $postID = $post->ID;
return get_post_meta($postID, $metakey, true);
}