Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why is $_REQUEST empty

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?

like image 847
Hawkseye Avatar asked Apr 18 '11 10:04

Hawkseye


People also ask

What is $_ request in PHP?

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.

Why do we use $_ request variable?

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.

What does empty mean in PHP?

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.


2 Answers

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"
like image 79
PaulP Avatar answered Sep 28 '22 06:09

PaulP


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.

like image 30
user3231437 Avatar answered Sep 28 '22 07:09

user3231437