Creating Simple Form in HTML

2
966

Our blog today will create a very simple form to take input from users. In the course of this blog we will learn the use of simple Radio buttons and Check boxes. We also use submit button which can be used to submit all the form details to a web service. So let get started, We will be using <form> to create a form today

Code

In the code above we have started by creating a simple HTML code with title Simple Form. In the body we have created a form action which is currently empty as we have not submitting it to any web service/page. The HTTP method we are using in our example is “Get”. Get is generally used when we are requesting data from a specified source. It can also be POST which is primarily used to submit data to a specified resource. We are calling the form by the name “Form”. In the lines below we create “NAME” and “ADDRESS” input fields.

In the above code we start with radio buttons inquiring gender from the user. It uses input type as radio. The check boxes are used for questions like languages and Social network. We use input type as “checkbox” If we render this HTML is a browser it will show

OUTPUT




SAMPLE FORM

Name:

Address:

Age:

JUST ANSWER SOME SIMPLE QUESTIONS PLZ:

Que:1 Select your gender.



Que:2 Select your martial status.



Que:3 Which one best describe you?



Que:4 Click on the items you have.







Que:5 Select the languages you like to work on.






Que:6 Select the social network you already joined.







We hope you understood the use of form and other input types with this post.

2 COMMENTS

  1. Hi, I followed and loved the course HTML5 from scratch.
    I have a couple of questions:
    How can i make the fields in a form required fields, so everybody has to fill in thos fields before submitting the form
    and how can I use the form in an existing website

    Regards,

    Marcel

    • You need to use javascript or jquery to do that. A basic google search will give you lot many answers.

Comments are closed.