Forside > PHP > PHP $_POST

PHP: $_POST

By Kristoffer Bohmann

How $_POST data work.

  • $_POST is an associative array of variables.
  • $_POST usually passes data from a web form to a result page that process the form data.
  • $_POST can also be sent in the background as AJAX data (so the user is never redirected to the result page).
  • $_POST is sent via the HTTP POST method.
  • $_POST is a superglobal and is therefore available in all scopes throughout a script (can be accessed from all functions, objects etc.).
  • $_POST data received from a public websites should not be trusted by the system (it is necessary to make the data "safe" and remove potential security threats before inserting into the database).
  • $_POST data is normally hidden to the user.
  • $_POST data can be viewed in Developer tools such as the FireBug add-on for FireFox.
  • $_POST is considered more secure than $_GET.
  • Result pages using $_POST data cannot be bookmarked by the user (use $_GET instead).
  • $_POST data is also available in the $_REQUEST varible.