Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

$_POST

$_POST is an associative array of variables, transmitted to the current script via the HTTP POST method, with the MIME types application/x-www-form-urlencoded or multipart/form-data.

The received values are all strings or arrays. They are strings by default, and other scalar types need a casting. The values are arrays when the URL uses the [] format.

$_POST is a superglobal: it is always available, in every scope.

Values inside $_POST are always strings, or arrays.

<?php

    // POST x=1
    $_POST['x'] === '1';
    
    // POST y=abc
    $_POST['y'] === 'abc';
    
    // POST z[]=def
    // POST z[]=ghi
    $_POST['z'] === ['def', 'ghi'];

?>

Documentation

See Also