Shameless plug: I gave a talk on names and the problems that arise when you give them special treatment - https://youtu.be/NfKhY3sAQ9E
But the tl;dw is to do this: <input type="text" name="name" />
I don't know what kind of app you're building, but unless it's 100% impossible (from a business perspective) not to separate people's names into multiple fields, you really should just make it one field.
If it's a true requirement for the business—due to a third-party vendor's requirements, for example—then I suppose you could simply ask the user which order they prefer and display their name accordingly.
But the tl;dw is to do this: <input type="text" name="name" />
I don't know what kind of app you're building, but unless it's 100% impossible (from a business perspective) not to separate people's names into multiple fields, you really should just make it one field.
If it's a true requirement for the business—due to a third-party vendor's requirements, for example—then I suppose you could simply ask the user which order they prefer and display their name accordingly.