Avoid duplicate ID for a field that appears multiple times on the same form
Drupal has a helper function for that:

drupal_html_id():


  Prepares a string for use as a valid HTML ID and guarantees uniqueness.