$_GET

Last updated

What is $_GET?

$_GET is a pre-defined array in PHP, that's used to collect form-data sent through HTTP GET method. It's useful whenever you need to process or interact with data that has been passed in via a URL's query string. For an example if you have a form with a GET method, you can get the values of the form elements through this global $_GET array. Here’s an example:

<form method="get" action="test.php">
  Name: <input type="text" name="fname">
  <input type="submit">
</form>

Using $_GET in test.php, you can fetch the 'fname' value from the URL:

echo "Name is: " . $_GET['fname'];

Free resources to learn $_GET

More in stage 8: Form Processing

$_GET: common questions

Can I learn $_GET 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 $_GET 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 $_GET tutorial for beginners?

It is lesson 46 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