Not working: json_decode( file_get_contents( 'php://input' ));

That doesn’t seem to be a JSON-encoded string, so it’s probably not surprising that you can’t JSON-decode it.

Did you intend to have two open FORM tags with only the outer one specifying the action parameter?

I don’t see any code that JSON-encodes the form contents on submission, is that somewhere else or is it just a standard form submission?

Is there any reason you can’t use the normal $_POST array to access the variables once you’re in loginapi.php?

1 Like