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
Loop through $_POST and see if the key contains 'item'.
$_POST
'item'
foreach($_POST as $key=>$value){ if(preg_match('/item(\d*)/', $key, $match) === 1){ inserttag($value, $match[1]); } }