PHP Form post


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


PHP $_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">
<p>
Salutation: <input type = "text" name = "nickname" />
</p>
<input type = "submit" value = "Submit" />
</form>

In comment.php, print $_POST information:

print_r($_POST);
?>

The output is as follows:

Array
(
   '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 DeveloperTut.com. All Rights Reserved.
TwitterGoogle+Facebook