← CodePrimer
PHP Beginner Forms

Read $_GET values

How do I read query string data?

$_GET superglobal.

Sample
<?php
$q = trim((string) ($_GET['q'] ?? ''));
echo htmlspecialchars($q, ENT_QUOTES, 'UTF-8');

Notes

Best for search/filters. Never trust raw input.

Keywords: $_GET · query · get · form

Related

Need more coins?

You do not have enough coins for this action.

Your balance: 0 coins

Share