php – Code Validation Field with post request

I’m trying to create a validation field in WordPress with the Snippets plugin.
The field should validate a 16 character code in its length and then perform a post request against a REST API.

I have problems with both because I do not know php.

Is it possible to do an html validation in a code snippet and a php post request at the same time ?
How could something like this look like ?

Thanks in advance!

Many greetings
Timon