$_REQUEST includes cookies which I do NOT want in my form posts.
- 
                    1Change `variables_order` in your php.ini to suit your needs. You can then safely doom your code to rely on proper input to `$_REQUEST`. – Linus Kleen Feb 28 '11 at 23:17
- 
                    @Linus Kleen That doesn't answer the question at all, despite being related to `$_REQUEST`. – coreyward Feb 28 '11 at 23:17
- 
                    @coreyward It kind of hints at the assumption that `$_REQUEST` contains all GPC, though. Also, answer the following: *"I need the result of `9 / 3`. Division is prone to divide by zero errors, which I do NOT want in my code."* – Linus Kleen Feb 28 '11 at 23:22
- 
                    @Linus Nice edit. Be clear in your answers — chances are someone asking a question isn't going to pick up on a slight hint. – coreyward Feb 28 '11 at 23:28
- 
                    @Linus Kleen Pffft, that's easy: just subtract a bunch of times. – Dan J Feb 28 '11 at 23:51
6 Answers
The php.ini setting responsible for what is in $_REQUEST is variables_order
Default: variables_order "EGPCS"
Change that in your php.ini to:
GP
for it to include only $_GET and $_POST
Maybe you don't want to do that
Usually in a web application you use $_GET values to select what to show and $_POST values to transmit what there is to change in a webpage (or user actions that change state in general). Generally it's not advisable to mix those :)
Also that answers explains it quite nice: When and why should $_REQUEST be used instead of $_GET / $_POST / $_COOKIE?
Or maybe read this: What's wrong with using $_REQUEST[]?
Also thanks for the comment mario :)
- 
                    +1 ... I didn't up-vote before because I don't like this sort of "clever" solution, but with the addition (and emphasis), I believe it's deserving. – Mar 01 '11 at 00:15
- 
                    4`variables_order` was only ever intended for changing the order. If unset to `GP` it will lead to an empty $_SERVER and $_COOKIE array. Hencewhy PHP 5.3 introduced `request_order` which specifically only affects $_REQUEST. – mario Mar 01 '11 at 00:17
You can change what $_REQUEST holds by looking into the php.ini setting variables_order.  Start here.
 
    
    - 13,823
- 14
- 58
- 90
You should not use $_REQUEST for exactly that reason. Access $_GET, $_POST and friends for their dedicated purposes instead of using $_REQUEST.
 
    
    - 860
- 1
- 7
- 15
You can simply use:
$_REQUEST = array_merge($_GET, $_POST);
Which has the benefit of explicitly listing the order you'd like so you don't override something you didn't expect because the REQUEST order was off.
 
    
    - 77,547
- 20
- 137
- 166
I would be explicit.
If a GET/POST merge is required in some context, then apply it then -- but I would avoid a blatant clobber. This merge can be easily done per-item and hidden behind a nice, tidy and default-applying wrapper -- perhaps even with a sanitizing/coversion layer right then and there.
No magic required. Happy coding.
- 
                    Thanks for the replies, they are all helpful. The best is to do an array_merge($_GET, $_POST); – Ken Mar 02 '11 at 16:59
 
     
     
    