I have a form that contains a number of fields with names item1, item2, item13, item43 etc, each time those fields are different because they are populated in the form with AJAX
Try:
foreach($_POST as $key=>$value){ inserttag($key, $value); }
$key will be the name of the element and $value will be the value.
$key
$value