02 May 2005

Php $_POST Variable

PGP $_POST variable is a predefined php variable name, and values are sent by the HTTP POST method, exactly like $_GET variable, but data sent from a form with $_POST method is invisible to user.


Example :

"myform.html":

<form action="collect.php" method="POST">
Name: <input type="text" name="name" />
Email: <input type="text" name="email" />
<input type="submit" />
</form>

"collect.php"

<? php
echo $_POST["name"] ."<br />";
echo $_POST["email"] ;
?>

With POST method you can send any amount of data from the HTML form. It is useful when you want to collect... large text, passwords etc.

No comments: