From signing in to a website, adding comments to facebook or finding information through search engine and much more, forms make the web go around in many ways. Actually, forms make it a two-way communication between the user and the computer. They are sometimes used with client-side scripts for web application functionality (calculators, etc...), but are mostly intended to send data across the internet.
Making forms
To create form needs a form element which itself posses two main attributes, action and method.
<form action="anotherwebpage.php" method="post">
<!-- some codes missing -->
</form>
All the other form fields like text, checkbox, submit, etc... are coded between the opening and closing form tags.
Action attribute
The value(anotherwebpage.php) of the action attribute tells the browser where to send the form data when it is submitted or where to redirect from the current page.
Method attribute
The method attribute can have one of the two values, get and post.
Here are the nature between the get and post values:
get value
- -the user is taken to a very specific URI.
- -used for reading something
- -this can be bookmarked or added to 'favourites' list or share it others because they have a very specific URI.
post value
- -will send the form data to HTTP-headers - hidden away where they are invisible to all but the form processing script.
- -used for writing something.
- -they cannot be bookmarked.
The major difference between the two is that the post value is much more secure than the get value and it is mostly trusted for writing private informations. The get value can be used for submitting public informations.
Other form elements
There are three formfield elements, input, textarea, and select, which helps the user to input datas to the form. These attributes contribute inputing text, checkbox data, radio buttons, submit button, selecting data from list which will be shown in the forthcoming posts.
No comments:
Post a Comment