Using values from the Joomla Input

Official Documentation: https://docs.joomla.org/Retrieving_request_data_using_JInput

In Joomla you don't access the $_GET or $_POST superglobals directly.

$jinput = JFactory::getApplication()->input;

// to get the server method
$post_or_get = $jinput->getMethod();

// The format is as follows. For the available filters see the doc linked above.
// Common filters are int, cmd and string - they're not case sensitive.
$foo = $jinput->get('varname', 'default_value', 'filter');

// to get a value from just get or post you can do
$post_example = $jinput->post->get('example', 0, 'int');

$fooUnfilteredFormValues = $jinput->getArray('jform');

$fooValues = $jinput->getArray([
    'var1' => 'int',
    'var2' => 'float',
    'var3' => 'word'
]);

$files = $jinput->files->get('jform');

// the files array will contain each file field like this:

$files['example_field_name'] = [
    ['name'] => 'youtube_icon.png',
    ['type'] => 'image/png',
    ['tmp_name'] => '/tmp/phpXoIpSD',
    ['error'] => 0,
    ['size'] => 34409,
];