I have Ubuntu 10.10 with apache2, php 5.3.3-1 and mysql 5.1.
I am passing some values to a page via URL. On that page, if I do print_r($_GET)
, then I see the array contents. But if I do print_r($_REQUEST)
the array is empty. Any ideas why this could be?
PHP $_REQUEST is a PHP super global variable which is used to collect data after submitting an HTML form. The example below shows a form with an input field and a submit button. When a user submits the data by clicking on "Submit", the form data is sent to the file specified in the action attribute of the <form> tag.
The $_REQUEST variable is used to read the data from the submitted HTML form. Sample code: Here, the $_REQUEST variable is used to read the submitted form field with the name 'username'. If the form is submitted without any value, then it will print as “Name is empty”, otherwise it will print the submitted value.
Definition and Usage The empty() function checks whether a variable is empty or not. This function returns false if the variable exists and is not empty, otherwise it returns true.
Also try check "request_order" option in php.ini:
; This directive determines which super global data (G,P,C,E & S) should
; be registered into the super global array REQUEST. If so, it also determines
; the order in which that data is registered. The values for this directive are
; specified in the same manner as the variables_order directive, EXCEPT one.
; Leaving this value empty will cause PHP to use the value set in the
; variables_order directive. It does not mean it will leave the super globals
; array REQUEST empty.
; Default Value: None
; Development Value: "GP"
; Production Value: "GP"
; http://php.net/request-order
request_order = "GP"
if your post body larger than post_max_size or upload_max_filesize which in the php.ini may be cause $_POST and $_REQUEST empty too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With