How to Create Interactive HTML Form

How to Create Interactive HTML Form:

HTML (Hyper Text Markup Language) is a powerful coding language, Which help us to develop interactive forms in quick ways. In earlier lesson, We learned that, How to create html table and learned about html list respectively. Now lets Move on little bit basic to advance side so, you will see that, We are expand out html course gradually. In this lesson, we will disclose to interactive html form. Developing interactive form is the major and essential element for web pages. After read this article or take this lesson, You will be capable to build your own forms in html. Sometime few bloggers and beginners faces unsatisfactory moments because they don’t have enough knowledge about html and development. Therefore, We always suggest that, If you are beginner so start with first lesson: What is HTML step by step Guide. Come back on topic, and start journey with interactive html forms. See the example code below and specially its result.

HTML Form

Above form is the combination of html and slightly include CSS (Cascading Style Sheets). we will show you step by step that how we build above form and make it attractive through CSS. I know that, We are learning about html form not CSS but without CSS ,we can’t made a form attractive like above form.  So, Let’s take start, We divided this above form in several steps to understand better and easy way.

 Step 1:

Open your best code editor but we used simple notepad for this form. After open editor, Now start typing code with open mind. First we need to provide open and closing tags of HTML and then start Body tags. Provide webpage title before body tag. After complete these mandatory tags. Start form code now, First we mention heading tags and inside heading tags write your form heading such as above form heading is “Submit Your Query” then we provide html list tags with instruction. First step process code are mentioned below.

<html>
<title>Submit Your Query</title>
<head></head>
<body>
<h2>Submit Your Query</h2>
<ol>
<li>
Fill only valid query, Which belongs to you.
</li>
<li>
You can discuss regarding your problem.
</li>
<li>
Beware about talking personal matters.
</li>
</ol>

In the above code we put OL Li tags, these are the html list tags. To understand in better way, You need to Read HTML List tags article.

Step 2:

After proceed first step, Now move on second step in which we start form structure with input box such as first name, email, message, buttons etc For this purpose in html, we utilize special code for these input boxes and buttons. See the entire code of html form below but in the next steps we will discuss separately on every part of below code.

First Name:
Last Name:
Email:
Type Your Message: <textarea name=”typemessage” cols=”20″ rows=”8″ value=”Submit Query”>

Don’t be confused and don’t feel panic because above code contains only few things first is “first name” box second is “last name box” third is input “email” box and finally is “type your message” box. But few things are looking different like html table tags and form tag. See the code below.

<Form name="Submit query" method="post" action="Link your server file">
</form>

This above code represents an appropriate form. Means that, above entire form structure are enclosed in the above form tag. Form tag instruction is that, Just place your form name inside of this form tag then tell the method of this form like post finally put the form action part, which could be a server-side action file. I will discuss you about server-side action file in our next article because this article only for interactive html form.

Discuss on Step 2 (Input Boxes):

Above we mentioned entire form code but now we discuss separately on every part of above code. To better understand the first name, last name, email and message boxes code see the example below.

<table border="3" class='form'>
<tr>
<td ><b>First Name:</b></td>
<td><input type="text" name="Firstname" size="20" value="Type your first name here"></td>
</tr>

In the above code, We cut the few piece of code for you to understand this code deeply.In the above short code , You can clearly see that, input type="text" This tiny code represent the empty box in html form. Slightly ahead, name="Firstname" This code represent the box name and this name is useful for server-side. Next is size="20" This tiny code arrange the width and height  size of the box,keep remember use numeric value to arrange size inside double quotes. Finally in the above code you will see value="Type your first name here" This code is used for write something else inside empty box, You can consider it as default text. Summarize the above whole code, Same as we developed three text box with the same procedure.

Discuss on Step 2 (Message Area):

Now move to the message or comment box in html form. we utilize different tags with different attributes. See the code below.

Type Your Message:
<textarea name="typemessage" cols="20" rows="8" value="Submit Query">

In the above code, After the table tags. You saw that, We used textarea tag to explain message or comment box in html form. We used textarea tag two times first for opening tag and second for closing tag with backslash. Next is name attribute same as above examples. Slightly ahead, You will see cols="20" rows="8" This attribute represent the number of columns and rows which are exist in the message box. You can increase or decrease the level of columns and rows.

Discuss on Step 2 (Input Buttons):

Finally, We reach on submit or reset buttons step, Where we understand the button coding in html form. See the code below.

<tr>
 <td colspan="2" align="Right"><input type="submit" name="submitquery" class='submitbutton'
 value="Submit Query" size="20">
 <input type="reset" name="reset" value="Reset" size="20" class='submitbutton'></td>
 </tr>

In the above code, first we utilize table tags same as above and tables attributes to arrange this form. Next is form buttons concept, which is quite simple. Same as above input type="submit" tag but little bit change. This time type is a submit instead of text. Name and value procedure are same as above examples.

Cascading Style Sheets (CSS):

As we said in the first paragraph, We utilize CSS code to make this form attractive. So that is our duty to reveal this code here. See the below CSS code, Which are attached with the above form.

<style>
.form{
background-color: #90C140;
font-family: Comic Sans MS;
color: White; 
font-size: 15px;
}
.submitbutton{
background-color: Blue;
border-radius: 12px;
color: White; 
}
</style>

You can manually add the above CSS code before starting html in this form. Then start your html form code with the above given instruction. Hope you will get success. Always care about opening and closing tag maybe it can be the cause of error or bug. Few articles are helpful to better understand this form construction. Must read below articles.

Sum up the above whole process or steps , You can develop  efficient and interactive html forms. Always do practice without practice that would not be possible to achieve your aims. For more fresh html or development articles or lessons subscribe our website. If you found any bug or error during practice then you can leave your question.

3 2 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments