INTRODUCTION 

Web development is a very vast topic as it covers a lot of materials, and even sometimes professional web developers cannot remember all of it.
Here we will be discussing the difference between name attribute and ID attribute in HTML.
Difference Between Id And Name In Html

NAME ATTRIBUTE

Name attribute in HTML indicates the name of an <input> element. The Name attribute is used to reference form data after a form is submitted or to reference elements in JavaScript. The name attribute is used for posting or sending data in a form submission in DOM (document object model).

ID ATTRIBUTE

ID attribute indicates a unique ID for HTML element. The ID attribute is mostly used in CSS, and by JavaScript who controls the element with the unique ID. The ID of a form has nothing to do with the data and information contained in it.
Both name attribute and ID attribute appear to have same purpose that of giving an identifier. The distinction is a name attribute exchanges transfers program to server and can be different in relation to the ID. ID is relied upon to be unique within the page.

CONCLUSION

Name and ID vary because the server is expecting the similar name from various forms in the similar document. The ID must be unique, the name most certainly not.

Suggested Reading