This entry is part 16 of 54 in the series PHP Tutorial

$_POST is an associative array of variables passed to the current script via the HTTP POST method.

$_POST['name'] = "Michael";
echo 'Hello ' . htmlspecialchars($_POST['name']) . '!';

You can try to run the script here.

The output in the browser will be:

Hello Michael!

$_POST is mainly used in form processing. ┬áIt is an associative array and so we can pass the name Michael using $_POST[‘name’].

Series Navigation<< PHP: $_GET
PHP: String operators >>