Hi,
The whole product page is inside a HTML "form" tag.
When you click on an add to cart button, the system automatically takes all the inputs inside that form and submits it.
If two inputs have the same name, the server will keep only the last one. So the first one will be lost.
That's why you get that problem with your customization.
What you should do is change the name of the second input and change the onclick event of the second add to cart in order to copy the value of the second input to the value of the first one before running the standard add to cart procedure.
So it is totally possible to do it with template overrides.