Returns a formatted ID based on the <i>$name</i> parameter and optionally the <i>$value</i> parameter.
This function determines the proper form field ID name based on the parameters. If a form field has an
array value as a name we need to convert them to proper and unique IDs like so:
name[] => name (if value == null)
name[] => name_value (if value != null)
name[bob] => name_bob
name[item][total] => name_item_total