There might be a solution if we can compare the expected form data against the actual form data when things go wrong.
Normally the actual form data is easily accessed by using a web browser’s developer tools.
I believe that PHP might also provide a way to display all of the submitted post data too.
Something like the following might be enough:
<?php echo json_encode($_POST);?>
But people in the PHP forum will have a much better idea about that side of things.