PHP - POST and GET method on the same page

php

Solution

You should use the `$_REQUEST` global variable. It contains all the data from both $_GET and $_POST.

Alternatively, you could check the request method.

$find = ($_SERVER['REQUEST_METHOD'] == 'GET') ? $_GET['find'] : $_POST['find'];

Problem

I would like to make a variable $find equal to $_POST['find'] if the user is landing on the page after using the POST method, but on the same page make $find equal to $_GET['find'] if the user is landing on the page after using the GET method. How do I do that? Thanks in advance, John ``` $find = $_GET['find']; $find = $_POST['find']; ```

Original source