Skip to main content

HTML Form attributes

HTML Form Attributes

In the last post we discussed about the html forms, types of forms and show you how to create a simple form.Though form creation is an important step but forms are useless until they send the entered information to a specific location.In this post, we'll discuss the form attributes which determine the action performed by the form.
The two main and most important attributes of a <form> tag are "action=" and "method=".Lets discuss each of these two.


  1. Action:When the user clicks the submit button, the content is sent to the server.The action attribute determines the location to which the content is sent.The file defined in the action attribute usually does something to the information which is done using the scripting languages.We'll not discuss that here. so, what does it look like....
    <form action="example.asp">
    Username:<input type="text" name="user"/>
    <input type="submit" value="submit"/>
    <'/form>


    And it looks like this in this blog....

    If you click the button then it will send the information to nowhere so it is just for practise.


  2. Method:method attribute determines how the information is sent to the server.There are two ways to send the information.One way is to send information in URL variables(method=get) and the other way is to send information in HTTP post transaction(method=post).

    Difference between the two are:-
    method=getmethod=post
    • Appends form data in the url in name-value pairs.
    • The length of the url can't exceed 3000 characters.
    • Never use GET to send important information because that will be visible in the url
    • Useful for non-secure data just like Google search query strings.
    • Appends data inside the body of http request.
    • Data is not visible in the url
    • Useful for sending secure/sensitive data.
    • Form submissions with post can't be bookmarked.


Now when you have the idea and all the useful knowledge about creating a form you can try your hand in the notepad and can see what happens.The are other types of forms also such as chech-boxes, radio buttons, drop down list and mail-to form.To get info about those see our post on types of HTML forms.

Comments

Popular posts from this blog

Image Search Engine Using Python

Images provide a lot more information than audio or text. Image processing is the prime field of research for robotics as well as search engines. In this article we will explore the concept of finding similarity between digital images using python. Then we will use our program to find top 10 search results inside a dataset of images for a given picture. It won't be as good as google's search engine because of the technique we will be using to find similarity between images. But what we are going to make will be pretty cool. So lets start. Setting up the Environment Our Algorithm How the code looks Lets build the GUI Additional Techniques Setting up the Environment The code we are going to write requires a few tools which we need to install first. I will try to be as precise as i can and if you get stuck into installing some tool then you can drop a comment below and i will help you sort out the problem. So here are the tools and the steps to install ...

Cordova viewport problem solved

Include the viewport settings in Cordova If you are facing the auto zooming problem of cordova then go read on the full article. Cordova actually ignores the viewport meta tag which causes the pixel density problem. So we need to tell cordova that viewport tag is equally important as other tags. To do this, we need to add some code to a file which is specify in the article. Corodva messes with pixels If you are using the latest cordova version or creating the cordova app for latest android versions then you may have faced the zoom malfunctioning.I also faced it when creating an app. Many of you may have already searched the web and found the answer of changing the meta tag attributes to get it working. But adding target-densitydpi=medium-dpi does not solve the problem for latest android versions. It may work for gingerbread but not for kitkat and others. So the final solution which i found was one of the stackexchange answer but rarely found. So i am gonna two things here, i ...

Why Interfaces are Awesome in Go

Why Interfaces are Awesome in Go Language Go, or Golang, is known for being a simple, yet powerful programming language. One of the core concepts that makes Go stand out is interfaces . Interfaces in Go help you write flexible, reusable, and maintainable code. They allow different types to share common behaviors without worrying about the exact type behind the scenes. In this article, we'll dive into why interfaces are awesome, with easy-to-understand examples. We’ll also give some tips on how to make the best use of them in your Go programs. What is an Interface? An interface in Go defines a set of method signatures (rules), but it doesn't provide the implementation. Instead, any type that implements these methods can be said to "satisfy" the interface. This allows you to write code that can work with different types as long as they share certain behaviors. Basic Example of an Interface package main import "fmt" // Define an interface with ...