Understanding the Form Tag

Lesson Details:
July 10, 2020


I: Introduction

Introduction:

A programming language is a language used to give commands to a computer. These languages are used to program software and applications. The first computer programming languages were called machine languages. A machine language’s code looks like machine code, which was nothing more than a series of numbers and letters that told the computer what to do. Machine languages had very simple commands and could only be used by programmers with a high level of knowledge and skill. Programs written in machine languages took a long time to develop and were not very efficient.

In the 1960s, two major things happened to make programming easier for developers. The first was the invention of assembly language, which gave developers a way to write programs in a language similar to the target computer’s machine language. Assembly languages still used numbers and letters but were more readable. Assembly languages allowed developers to write smaller programs that ran faster than those written in machine languages. The second major development that made programming easier for developers was the invention of high-level programming languages. High-level languages allowed developers to write programs using words and sentences instead of numbers and letters. High-level languages made it easier for people with little or no programming experience to create programs. Mainframe computers from IBM, Digital Equipment Corporation, and others were the first machines to use high-level languages, making them popular among companies who needed to quickly develop large amounts of software, such as banks and insurance companies. In the 1970s, personal computers started appearing on store shelves. These personal computers revolutionized computing by allowing average people to have their own computers instead of just companies and universities. Personal computer manufacturers struggled to compete with each other because they all used different kinds of operating systems. Microsoft created a new kind of high-level language called BASIC that became the standard for personal computers. Microsoft developed several versions of BASIC that supported different types of hardware. BASIC became so popular that it was available on most home computers during the 1980s and 1990s.

Computer programming languages can be grouped into three major categories: procedural languages, object-oriented languages, and functional languages. Procedural languages are based on statements or commands that are executed one at a time by the computer. Object-oriented languages are based on objects that contain attributes and methods, which are data and functions stored within an object. Functional languages are based on mathematical functions that are executed either sequentially or in parallel. Languages also vary in their size, which refers to how many lines of code the language can hold at one time, and their structure, which refers to how the code is structured inside the language. Some languages offer operators for mathematical operations while others offer functions for mathematical operations. Some languages offer loops for repetitive actions while others do not offer loops at all. Some languages offer classes while others do not offer classes at all. Finally, some languages allow function definitions while others do not allow function definitions at all.

II: Body

Understanding the form tag

The form tag allows you to create an HTML form on your webpage. Forms help you gather information from users on your site through text boxes, dropdown menus, radio buttons, checkboxes, etc. Users will fill out the form fields with information about themselves, then submit them to you via email or through another form action.



The opening
tag tells the browser that this is an HTML form element. One or more input elements can be placed between the opening tag and the closing
tag. For example:
The value attribute tells the browser what value should be put into the field when the user submits the form. For example:
Username: Password:
The action attribute specifies where the browser should take the submitted form data when it is submitted. The method attribute specifies how the data should be sent (GET or POST). Note that when using forms for "regular" HTML pages (not PHP ones), you do not need any special tags or attributes in order for your server script to get access to HTTP POST data; it is passed along automatically! However, you will need some way of processing said POST data — PHP itself cannot do anything with it directly (except perhaps log it). We'll see how to do so below. This is usually done with some scripting language such as PHP or Perl — but if you don't want to install any extensions, then there are other options too (see below). You can specify multiple input elements by putting them between
and
. All of these input elements will appear on one page when submitted to your server script:
Username: Password:
When creating forms, it is important to remember that they must be closed properly (i.e., end with a tag) in order for your server script to get proper access to HTTP POST data; otherwise this automatic transmission of POST data does not occur (and it may cause problems such as blank pages). It is also important to remember that the closing must appear before the end of the document (, etc.) — otherwise most browsers will display a warning message in most cases stating something like “you forgot a tag somewhere after the form” (which is helpful if there is a syntax error in your form!); however most browsers will not show this warning if it appears before the end of your document since they have assumed there is no longer a form present once everything has been output). Of course, you can place multiple input elements between
and
tags if you need more than one input element on a single page when submitted to your server script:
Username: Password:
The textarea element allows you to create a multi-line text box in an HTML form:
Username: Password: Hello:
When creating forms, it is important to remember that they must be closed properly (i.e., end with a tag) in order for your server script to get proper access to HTTP POST data; otherwise this automatic transmission of POST data does not occur (and it may cause problems such as blank pages). It is also important to remember that the closing must appear before the end of the document (, etc.) — otherwise most browsers will display a warning message in most cases stating something like “you forgot a tag somewhere after the form” (which is helpful if there is a syntax error in your form!); however most browsers will not show this warning if it appears before the end of your document since they have assumed there is no longer a form present once everything has been output). Of course, you can place multiple input elements between
and
tags if you need more than one input element on a single page when submitted to your server script:
Username: Hello:
The button element allows you to create an HTML button in an HTML form:
Username: What would you like? I'm bored... Click Me!
loader
Course content