Text box

Updated: 04/26/2017 by Computer Hope

Text boxAlternatively referred to as a text field, a text box is a section of a page that enables a user to enter text. Text boxes are often used on the Internet for pages that require input from a user. Below are some examples of text boxes you are likely to encounter.

One-line text box
Below is an example of a one-line text box that only accepts a few words and is often used for a name, e-mail, or password.

Multiple line textarea box
Below is an example of a multiple line textarea text box for entering a lot of data and is often used for typing a message.

Creating an HTML text box

Below is the HTML source code that creates each of the above boxes using the HTML form tag, input tag, and textarea tag. The input tag with the name attribute is a single one-line text box, and the textarea tag is the multiple line text box. The "script name" in the action attribute should be changed to the name and location of your script file. For example, it could be changed to an ASP, Perl, PHP, or Python script file.

<form action="script name" method="get">
Name: <input type="text" name="name"><br>
Message: <textarea rows="2" cols="20"></textarea><br>
<input type="submit" value="Submit">

Spin box, Text, Textarea