Blue Theme Orange Theme Green Theme Red Theme
 
Team Foundation Server Hosting
Home | Forums | ASP.NET 2.0 Tutorials | Web Services | How Do I...? | Class Browser | WPF Quick Starts | Advertise with Us
 | Consulting  
Submit an Article Submit a Blog 
 Jump to
Skip Navigation Links
TechnologyExpand Technology
WebsiteExpand Website
Mindcracker MVP Summit 2012
Search :       Advanced Search »
Home » HTML » Forms in HTML - Part 2

Forms in HTML - Part 2

In this article I will explain Forms in HTML

Author Rank :
Page Views : 1337
Downloads : 0
Rating :
 Rate it
Level : Beginner
   Print Read/Post comments Post a comment  Similar Articles  
   Email to a friend  Bookmark  Author's other articles  
 
Mindcracker MVP Summit 2012
Become a Sponsor
 Tag Cloud
 Latest Jobs
More ... 
 Latest Interview Questions
More ... 



Forms add the ability to web pages to not only provide the person viewing the document with dynamic information but also to obtain information from the person viewing it, and process that information.

A form is an area that can contain form elements. Form elements are elements that allow the user to enter information (like text fields, textarea fields, drop-down menus, radio buttons, checkboxes, select, drop down list etc.) in a form.

To insert a form we use the <form>...</form>
tags. The rest of the form elements must be inserted in between the form tags.

NOTE: The FORM element has no formatting attributes.

Text Area

Textarea is an element that allows for free form text entry.

<
TEXTAREA> </TEXTAREA>
Textarea has the following attributes:

NAME: is the name of the variable.
ROWS: the number of rows to the textbox.

COLS: the number of columns to the textbox.

HTML code for TEXT AREA:

html>
     <head>
            <title>Forms in HTML</title>    
</
head>
        <body>

<
form name="input" action="html_form_submit.asp" method="get">
<br> Please enter something about yourself:<br>
<
textarea rows="5" name="textareaBox" cols="50">Write something</textarea></p>
</
form>
      </body>

</
html>

Select

The two following examples are <SELECT> </SELECT> elements, where the attributes are set differently.

<SELECT> </SELECT>
The Select element's attributes are:

NAME: is the name of the variable.
SIZE: This sets the number of visible choices.

MULTIPLE: The presence of this attribute signifies that the user can make multiple selections. By default only one selection is allowed.

HTML code for SELECT:

html>
     <head>
            <title>Forms in HTML</title>    
</
head>
        <body>

<
form name="input" action="html_form_submit.asp" method="get">
<p>Select country where you worked:</p>
      <p><select size="3" name="country" multiple>
      <option selected>India</option>
      <option>United States</option>
      <option>Germany</option>
      <option>China</option>
      <option>Pakistan</option>
      <option>Australia</option>
      <option>Sri Lanka</option>
      <option>Canada</option>
      </select></p>

</
form>
      </body>

</
html>

Drop Down List

The drop down selection list is an element of HTML forms. It consists of a set of options along with their associated values and some text. This text (not the value) is displayed in the drop down selection list.

HTML code for DROP DOWN LIST:

html>
     <head>
            <title>Forms in HTML</title>    
</
head>
        <body>

<
form name="input" action="html_form_submit.asp" method="get">
<
p>Enter your book interest<br>
      <SELECT NAME="mylist">

<
OPTION VALUE="m1">Cape Fear
<
OPTION VALUE="m2">The Good, the Bad and the Ugly
<
OPTION VALUE="m3">The Omen
<
OPTION VALUE="m4">The Godfather
<
OPTION VALUE="m5">Forrest Gump
</
SELECT>
</
p>
</
form>
      </body>

</
html>

You can use all the form fields in a single html webpage. The code for the same is given below.

<html>
     <head>
            <title>Forms in HTML</title>
     </head>
        <body>

<
br> Please enter something about yourself:<br>
<
textarea rows="5" name="textareaBox" cols="50">Write something</textarea></p>
<
p>Select country where you worked:
     <p><select size="3" name="country" multiple>
      <option selected>India</option>
      <option>United States</option>
      <option>Germany</option>
      <option>China</option>
      <option>Pakistan</option>
      <option>Australia</option>
      <option>Sri Lanka</option>
      <option>Canada</option>
      </select></p>

<
p>Enter your book interest<br>
      <SELECT NAME="mylist">

<
OPTION VALUE="m1">VB.NET
<
OPTION VALUE="m2">C#.NET
<OPTION VALUE="m3">Microsoft SQL Server
<
OPTION VALUE="m4">HTML Coding
<
OPTION VALUE="m5">GUI Programming
</
SELECT>
</
p>
</
form>
</
form>
     </body>

</
html>

You can simply copy paste the code in the notepad and save as with some name and extension as "html" or "htm" and see the effect on your browser. Hope the article would have helped you making a grasp on html coding. I will be explaining more about HTML forms in my next article. So be inline.

Comment Request!
Thank you for reading this post. Please post your feedback, question, or comments about this post Here.
Login to add your contents and source code to this article
 [Top] Rate this article
 
 About the author
 
Puran Mehra

Working as a Software professional. 

Looking for C# Consulting?
C# Consulting is founded in 2002 by the founders of C# Corner. Unlike a traditional consulting company, our consultants are well-known experts in .NET and many of them are MVPs, authors, and trainers. We specialize in Microsoft .NET development and utilize Agile Development and Extreme Programming practices to provide fast pace quick turnaround results. Our software development model is a mix of Agile Development, traditional SDLC, and Waterfall models.
Click here to learn more about C# Consulting.
 
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
Discover the top 5 tips for understanding .NET
Ricky Leeks presents the top 5 tips for understanding .NET Interoperability. Learn more.
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
ASP.NET 4 Hosting
Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites – Click Here!
 
 Post a Feedback, Comment, or Question about this article
Subject:
Comment:
Discover the top 5 tips for understanding .NET Interop
Become a Sponsor
 Comments
Team Foundation Server Hosting
 © 2012  contents copyright of their authors. Rest everything copyright Mindcracker. All rights reserved.