if (isset($_GET['name'])) { $name = $_GET['name']; echo "Hello, $name!"; }
if ($_SERVER['REQUEST_METHOD'] == 'POST') { $username = $_POST['username']; $password = $_POST['password']; // Validate username and password }In this example, the function checks the request method to see if it is a POST request. If it is, then the username and password values are retrieved from the POST data and can be validated or used in further processing. This function is part of the PHP core and does not require any package or library to use.