$_REQUEST

Last updated

What is $_REQUEST?

$_REQUEST is a PHP superglobal variable that contains the contents of both $_GET, $_POST, and $_COOKIE. It is used to collect data sent via both the GET and POST methods, as well as cookies. $_REQUEST is useful if you do not care about the method used to send data, but its usage is generally discouraged as it could lead to security vulnerabilities. Here's a simple example:

$name = $_REQUEST['name'];

This statement will store the value of the 'name' field sent through either a GET or POST method. Always remember to sanitize user input to avoid security problems.

Free resources to learn $_REQUEST

More in stage 8: Form Processing

$_REQUEST: common questions

Can I learn $_REQUEST in Hindi?

This lesson is written in English. Once you sign in, open it in the interactive course and ask the AI tutor to explain $_REQUEST in Hindi or Hinglish. The tutor answers from this lesson’s own text, so it stays on the syllabus, and it runs on your own Google, OpenAI or Anthropic key.

Is this $_REQUEST tutorial for beginners?

It is lesson 48 of 120 in the free PHP roadmap, in stage 8, Form Processing. If you are new to PHP, start from stage 1 and come back here in order; if you already know the earlier stages, this lesson stands on its own.

Still confused? Ask me