HTML form
In most of the operations, we have to get some data from the user and use PHP code to process those data. HTML form provides an easy way for the user to input data. Cases such as login page, member registration page.
Put the HTML form where you like it to appear in the body section, the HTML form codes are:
<form> .... </form>
Form tags have created but just the HTML codes above has no use, we have to place some attributes and elements into the form.
Let’s talk about the attributes of the form. There are many of them but I want to talk about the 3 attributes which I normally use.
- “name” – to give a name to the form. Example:
<form name="form1"> .... </form>
- “method” – the way to use to sent the form: There are 2 ways get/post. I normally use “post”. Example:
<form name="form1" method="post"> .... </form>
- “action” – The URL which the form’s data will be send to. Example:
<form name="form1" method="post" action="test.php"> .... </form>
For the form elements such as text field, submit button etc. and the way to fetch the form data with PHP, I will talk about those in other posts.





