PHP Form Handling
Handling HTML forms.
PHP - A Simple HTML Form
The example below displays a simple HTML form with two input fields and a submit button:
<form action="welcome.php" method="post">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>
GET vs POST
Both GET and POST create an array (e.g. array( key => value, key2 => value2, key3 => value3, ...)). This array holds key/value pairs, where keys are the names of the form controls and values are the input data from the user.
- GET: Parameters are visible in the URL. Useful for bookmarks. Not for sensitive data. Limit on length (2000 chars).
- POST: Parameters are not visible in the URL. No limits on data length. Supports binary data (files).