PHP Form post

The $_POST variable is used to receive form information sent by the form method = "post".


The $_POST variable is used to get the form data sent by HTTP POST. Its data structure is an associative array, the key name for the form element name, value for the corresponding form value.

Form form.php:

<form name = "commentform" method = "post" action = "comment.php">
Salutation: <input type = "text" name = "nickname" />
<input type = "submit" value = "Submit" />

In comment.php, print $_POST information:


The output is as follows:

   'nickname' >=>

Access the $_POST variable

You can access the $_POST variable as easily as accessing an ordinary array:

echo 'Your name is:', $_POST["nickname"];

POST method to send data to anyone is not visible, and the amount of information sent almost unlimited, for sensitive data(such as passwords) or large-capacity data information submitted, usually using the POST method.

Copyright 2014-2017 by All Rights Reserved.