formData and Firefox

I am using the following to capture data from an external website the get directed to my web page.

This works fine in Chrome and am able to see all key/value pairs but does not work in Firefox.

if(isset($_POST)){
	foreach ($_POST as $key => $value){
	 echo "Field ".htmlspecialchars($key)." is ".htmlspecialchars($value)."<br>";
	} 
}

Any advice?

Can you expand on “does not work”? I can’t see anything particularly untoward, though it’s a long time since I used Firefox.

1 Like

POST data is empty in firefox, but contains all correct values in Chrome

Just look at the request type from both pictures. The one in Chrome is a POST request while the one in FireFox is a GET request. I assume there’s something wrong in the code or something was redacted from the posted code.

Thanks for highlighting the obvious.
Seems to be the problem.

Many thanks

Server-side scripting like php is browser agnostic, so it should not make any difference.
This points to a problem on the client side, likely the html of the form.

Best to check for (post) form submission like this:-

 if($_SERVER['REQUEST_METHOD'] === 'POST'){
   // form processing here
}
1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.