<form method="" action="">
This creates the form block, which is closed at the bottom of the page. The information that goes inside the quotes is very important. method refers to the HTTP Protocol method that is to be used, usually get or post. In this case it should be post. action refers to the location of the server page that will handle the request. A file has been created for you in the language PHP to handle the form request. (You will need to use Save link as ... since clicking it actually runs the file on the server and then change the extension from txt to php) If you upload this file to your website now you simply need to point to that location. This file is already located on this server at: https://webdev0.brambling.cdu.edu.au/reply.php
You need to put this into the action so the form points to the appropriate file.pattern="[0-9]{4}"
as an attribute to the postcode input restricts this to 4 numeral characters only. By the way the error message if the user types in the wrong pattern can be customised using the title attribute.checked
(to radio buttons) or selected
(to drop down menu) will pre-select these. autofocus
to one input box will move the flashing cursor to that box.width
which can be used in the HTML quite appropriately to set up column widths.The Internet is not just one thing, it's a collection of things - of numerous communications networks that all speak the same digital language. Jim Clark, Founder of Netscape 1993
HTTP (Hyper Text Transfer Protocol) is the protocol that web pages use to communicate with a web server. This is a complex protocol that was first developed in 1999 by W3C. Hyperlinks using the anchor tag and web site URLs are just part of the protocol. The protocol also has ways to get specific information or change information stored on the server. This process uses GET and POST requests.
These are the most common requests for information from a web page. The details are:
A form in HTML is the normal way that web pages create and submit HTTP get and post requests.
Since HTTP requests are carrying information to which servers will respond, there are security implications in the creation of any request. HTML does not provide any way to handle this, the issue of security needs to be handled by programming languages. Javascript can be used to check the information before it leaves the web page and the programming language on the server can also be used to do the same job before any changes are made. This is called validation and the best practise is for all form submissions to have both server side and client side validation. Since both Javascript and server languages are beyond the scope of this course, the forms created here will not have any validation, so should not be used on a real website.
Ajax (Asynchonous JavaScript and XML) is a term used to describe the process of placing information onto a web page without the need for a page refresh. Under HTTP the usual method of gaining information from a web server involves a HTTP request to the server, either as a URL, get or post request, followed by a response by the server. This response was often in the form of a full web page. Ajax allows the server to only send the new information, which is then transformed by the Javascript into HTML and placed on the existing page.
In the last few year there have been many Javascript libraries developed around the Ajax principle. Using these libraries it is now possible to sent HTTP requests from a web page without using forms at all. In Session 6 we will be exploring some of these libraries, however the best practise is to always create HTML forms for any information that will be sent using HTTP requests. Knowing how to create a well structured form is an essential skill for a web developer.
In this course we are really only covering part of the picture with HTTP requests. Creation of forms only shows how the information is created and packaged. To really understand this you do need to study how the information is used on a server using a programming language like PHP and how the information is stored on a web server, usually in a database. In addition you need to understand how the information is returned to the web page, using a HTTP response. This is often in the format of XML or Json. Finally you need to understand how to take this information and inject it back into the web page using Ajax techniques. This course only provides the first component of this knowledge.
Tables have been in HTML since the beginning and work very much the same as tables in Microsoft Word. They were used in early web sites to help lay out the pages, especially before CSS. However now that CSS is much more powerful Web Developers are trying to return tables to their Semantic usage, to be used for displaying data. The most common use of tables in modern websites is to layout data that comes from the server at run time, ie this data will not be known by the developer when the page is created.
The whole table is wrapped in the table
tag. Inside this each row is created using the tr
tag. Inside each row there can be a number of cells each with their own td
tag. Each cell contains the data which can be text, images, or even other HTML tags including whole tables or forms The table then will automatically adjust its size to the content and lay out the table in the best way possible. You can pre-determine the width of each column by setting up the same number of cells in each row and adding a width attribute to the cells in the first row. However tables are flexible and there is no requirement to have the same number of cells in each row, it is just easier that way. HTML5 has introduced more tags relating to tables including th
and thead
for a header cells, tfoot
and tbody
.