The extract() Function is an inbuilt function in PHP. The extract() function does array to variable conversion. That is it converts array keys into variable names and array values into variable value. In other words, we can say that the extract() function imports variables from an array to the symbol table.

You have to put below code on top of your PHP code, so you can access $q directly instead of $_POST['q']

extract( $_POST);
extract( $_GET);
extract( $_COOKIE);

If you want to use server variable like PHP_SELF directly, you will need add below on top of your PHP code.

extract( $_SERVER);