PHP Form Handling Notes
PHP Form Handling Notes
<html>
<body>
<form action="form-handler.php"
method="POST">
Name: <input type="text" name="name">
<br/>
Email: <input type="text"
name="email"> <br/>
<input type="submit">
</form>
</body>
</html>
In the code above, we have used the <form> tag to create an HTML
form, with input fields for Name and Email along with submit
button to submit the form-data.
<?php
?>
Hi, epche
You will get the above output, if you provide name as "epche" and
email address as "[email protected]".
Below we have the same form with method as GET,
<html>
<body>
<form action="form-handler.php"
method="GET">
Name: <input type="text" name="name">
<br/>
Email: <input type="text"
name="email"> <br/>
<input type="submit">
</form>
</body>
</html>
<?php
?>
Hi, epche
When a user submits a form, the values from the input fields are
stored in an array, like array(key1=>value1, key2=>value2,...) and then
passed on to the destination(Php file) specified in the action attribute
of the <form> tag.