The name attribute is for submitting a form element to the server; many elements may share the same name (e.g. radio buttons, which must have the same name within the set).
The id attribute is for uniquely identifying any element (not just form elements). It must be unique throughout the entire document.