What are best practices for handling form submissions in PHP to ensure compatibility with both mouse clicks and the ENTER key?

When handling form submissions in PHP, it's important to ensure compatibility with both mouse clicks and the ENTER key. One common approach is to check for the form submission using the $_POST superglobal and the isset() function. This way, whether the form is submitted by clicking a submit button or by pressing ENTER, the form data can be processed correctly.

if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["submit"])) {
    // Process form data here
}