slide1 l.
Skip this Video
Loading SlideShow in 5 Seconds..
en.wikipedia/wiki/Http PowerPoint Presentation
Download Presentation

Loading in 2 Seconds...

play fullscreen
1 / 78

en.wikipedia/wiki/Http - PowerPoint PPT Presentation

  • Uploaded on Hypertext Transfer Protocol ( HTTP ) is a communications protocol for the transfer of information on the Internet . Its use for retrieving inter-linked text documents ( hypertext ) led to the establishment of the World Wide Web .

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'en.wikipedia/wiki/Http' - benjamin

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

Hypertext Transfer Protocol (HTTP) is a communications protocol

for the transfer of information on the Internet.

Its use for retrieving inter-linked text documents (hypertext)

led to the establishment of the World Wide Web.

HTTP development was coordinated by the World Wide Web Consortium

and the Internet Engineering Task Force (IETF),

culminating in the publication of a series of Request for Comments (RFCs),

most notably RFC 2616 (June 1999),

which defines HTTP/1.1, the version of HTTP in common use.


HTTP is a request/response standard between a client and a server.

A client is the end-user, the server is the web site. The client making an HTTP request - using a web browser, spider, or other end-user tool - is referred to as the user agent.

The responding server - which stores or creates resources such as HTML files and images - is called the origin server.


Typically, an HTTP client initiates a request.

It establishes a Transmission Control Protocol (TCP) connection to a particular port on a host (port 80 by default; see List of TCP and UDP port numbers).

An HTTP server listening on that port waits for the client to send a request message. Upon receiving the request, the server sends back a status line, such as "HTTP/1.1 200 OK", and a message of its own, the body of which is perhaps the requested file, an error message, or some other information.

Resources to be accessed by HTTP are identified using Uniform Resource Identifiers (URIs) (or, more specifically, Uniform Resource Locators (URLs)) using the http: or httpsURI schemes.


HTML, an initialism of HyperText Markup Language,

is the predominant markup language for Web pages.

It provides a means to describe the structure of

text-based information in a document

— by denoting certain text as links, headings, paragraphs, lists, and so on —

and to supplement that text with interactive forms, embedded images,

and other objects.

HTML is written in the form of tags, surrounded by angle brackets.

HTML can also describe, to some degree, the appearance and semantics

of a document, and can include embedded scripting language code

(such as JavaScript) which can affect the behavior of Web browsers

and other HTML processors.

By convention, HTML format data files use a file extension .html or .htm.


Following is from HTML tutorial at




<title>Title of page</title>


<body> This is my first homepage. <b>This text is bold</b>



Save the file as "mypage.htm". Start your Internet browser. Select "Open" (or "Open Page") in the File menu of your browser. A dialog box will appear. Select "Browse" (or "Choose File") and locate the HTML file you just created - "mypage.htm" - select it and click "Open". Now you should see an address in the dialog box, for example "C:\MyDocuments\mypage.htm". Click OK, and the browser will display the page.


This is an HTML element:

<b>This text is bold</b>

The HTML element starts with a start tag: <b>The content of the HTML element is: This text is boldThe HTML element ends with an end tag: </b>

The purpose of the <b> tag is to define an HTML element

that should be displayed as bold.

This is also an HTML element:

<body> This is my first homepage.

<b>This text is bold</b>


This HTML element starts with the start tag <body>,

and ends with the end tag </body>.

The purpose of the <body> tag is to define the HTML

element that contains the body of the HTML document.


We have just said that HTML tags are not case sensitive:

<B> means the same as <b>.

If you surf the Web, you will notice that plenty of web sites

use uppercase HTML tags in their source code.

We always use lowercase tags.


If you want to follow the latest web standards,

you should always use lowercase tags.

The World Wide Web Consortium (W3C) recommends

lowercase tags in their HTML 4 recommendation,

and XHTML (the next generation HTML) demands

lowercase tags.


Experiment with html here:


Paragraphs are defined with the <p> tag.

<p>This is a paragraph</p>

<p>This is another paragraph</p>

HTML automatically adds an extra blank line before and after a paragraph.

Don't Forget the Closing Tag

You might have noticed that paragraphs can be written without end tags </p>:

<p>This is a paragraph

<p>This is another paragraph

The example above will work in most browsers, but don't rely on it.

Future version of HTML will not allow you to skip ANY end tags.

Closing all HTML elements with an end tag is a

future-proof way of writing HTML.

It also makes the code easier to understand (read and browse)

when you mark both where an element starts and where it ends.


Line Breaks

The <br> tag is used when you want to break a line,

but don't want to start a new paragraph.

The <br> tag forces a line break wherever you place it.

<p>This <br> is a para<br>graph with line breaks</p>

Try it yourself

The <br> tag is an empty tag.

It has no end tag like </br>,

since a closing tag doesn't make any sense.


<br> or <br />

More and more often you will see the <br> tag written like this:

<br />

Because the <br> tag has no end tag (or closing tag),

it breaks one of the rules for future HTML

(the XML based XHTML),

namely that all elements must be closed.

Writing it like <br /> is a future proof way of closing

(or ending) the tag inside the opening tag,

accepted by both HTML and XML.


Comments in HTML

The comment tag is used to insert a comment in the HTML source code.

A comment will be ignored by the browser.

You can use comments to explain your code,

which can help you when you edit the source code at a later date.

<!-- This is a comment -->

Note that you need an exclamation point after the opening bracket,

but not before the closing bracket.


Recap on HTML Elements

Each HTML element has an element name (body, h1, p, br)

The start tag is the name surrounded by angle brackets:


The end tag is a slash and the name surrounded by

angle brackets </h1>

The element content occurs between the start tag and

the end tag

Some HTML elements have no content

Some HTML elements have no end tag


There is quite a bit more in this HTML

Tutorial, but we will not go through that now.


PHP is a computer scripting language.

Originally designed for producing dynamic web pages,

it has evolved to include a command line interface capability

and can be used in standalonegraphical applications.[2]

While PHP was originally created by Rasmus Lerdorf in 1995,

the main implementation of PHP is now produced by The PHP Group

and serves as the de facto standard for PHP as there is no formal specification.[3]

Released under the PHP License, the Free Software Foundation

considers it to be free software.[4]


PHP is a widely used general-purpose scripting language

that is especially suited for web development

and can be embedded into HTML.

It generally runs on a web server, taking PHP code as its input

and creating web pages as output.

It can be deployed on most web servers

and on almost every operating system and platform free of charge.[5]


PHP primarily acts as a filter,[31]

taking input from a file or stream

containing text and/or PHP instructions

and outputs another stream of data;

most commonly the output will be HTML.


Originally designed to create dynamic web pages,

PHP's principal focus is server-side scripting,[35]

and it is similar to other server-side scripting languages

that provide dynamic content from a web server to a client,

such as Microsoft's ASP.NET system,

Sun Microsystems' JavaServer Pages,[36] and mod_perl.


PHP has also attracted the development of many frameworks

that provide building blocks and a design structure to promote rapid application development (RAD). Some of these include CakePHP, PRADO, Symfony and Zend Framework, offering features similar to other web application frameworks.

The LAMP architecture has become popular in the web industry as a way of deploying web applications. PHP is commonly used as the P in this bundle alongside Linux, Apache and MySQL, although the P may also refer to Python or Perl.


As of April 2007, over 20 million Internet domains were hosted on servers with PHP installed, and PHP was recorded as the most popular Apache module.[37] Significant websites are written in PHP including the user-facing portion of Facebook,[38][39] and Wikipedia (Mediawiki).[40]


Following is from PHP tutorial:


Start up Apache and PHP


Select phpinfo()

Find “document_root”


<html><head><title>PHP Test</title></head><body><?php phpinfo(); ?></body></html>

Save as first.htm at document root.


Save as first.php at document root.



…each statement in your PHP code is ended with a semicolon. 

Leaving this semicolon off is a common syntax error

and when something isn't working the way you expect

it to should be one of the first things you check.

Whitespace (spaces, tabs and newlines) are ignored in the syntax of PHP. 

These three examples are completely equivalent:

<?php phpinfo(); ?>

<?php     phpinfo();     ?>

<?php phpinfo();?>


As in all forms of programming, adding comments to you code is

a very useful idea. 

Make your code self-documenting and you will love yourself later

when you come back to if after having forgotten

why you did things a certain way!


Here are some examples:

<?phpphpinfo();/*  This is a      multi-line comment following     the C language style of comments.*/?>

<?php  // this is a C++ style comment on the one code linephpinfo();?>

<?php  # this is a shell script style comment on the one code linephpinfo();?>


We continue now by creating a simple order form.  The processing of forms like this is one of the more common things to be done with server side languages including PHP.  For our example we have chosen the component order form from the Acme Widget Company (of course!)  Here's the code for the entire form:


<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>Acme Widget Company</title></head><body style="font-family: Arial"><h1><br>Acme Widget Company</h1><p>Component Order Form</p>


<FORM ACTION="processorder.php" method=post><table border=0><tr><td width=150>Item<br>&nbsp;</td><td width=15>Quantity<br>&nbsp;</td></tr><tr><td>Bases</td><td align="center"><input type="text" name="qtybases" size="3" maxlength="3"></td></tr><tr><td>Stems</td>


<td align="center"><input type="text" name="qtystems" size="3" maxlength="3"></td></tr><tr><td>Tops</td><td align="center"><input type="text" name="qtytops" size="3" maxlength="3"></td></tr><tr><td colspan="2" align="center"><br><input type="submit" value="Enter Order"></td></tr></table></form></body></html>


You can click here to see what this form looks like in your browser.

Now let's break it down.  As with our last example, most of the code you see is ordinary HTML. 


Notice, however, that the ACTION= on the FORM statement points to a PHP file called processorder.php (the capitals we've used here are only to highlight to code we're talking about - it doesn't make any difference whether you use capitals or lowercase letters, except that the filename may be case sensitive if your site is hosted on a Unix/Linux system.).

When the user hits the "enter order" button, the file whose name (URL) appears in the ACTION statement will be loaded and the data the user typed into the form elements will be passed to it. 

The data will be identified to that file by the field names used on the form, here "qtybases", "qtystems"  and "qtytops".  For this reason it's a good idea to use easily recognized and meaningful names, such as ours are.


There's really no PHP code in this form (which is why it's in a file named with a .html extension) so we'll move right along to the file that will process our order.


Our order form sent its data to a file called processorder.php via the instruction:

ACTION="processorder.php" method=post

This is the content of that file:

<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>Acme Widget Company</title></head><body style="font-family: Arial"><h1><br>Acme Widget Company</h1><p>&nbsp;</p>



$qtybases = $_POST['qtybases'];$qtystems = $_POST['qtystems'];$qtytops = $_POST['qtytops'];?><p>Thank you!</p><p>Your order for:</p><?php

echo $qtybases.' bases<br>';echo $qtystems.' stems<br>';echo $qtytops.' tops<br>';?><p>was processed.</p></body></html>


In here there's plenty of interesting PHP code to take a look at!  We'll start with that first piece of PHP code:$qtybases = $_POST['qtybases'];$qtystems = $_POST['qtystems'];$qtytops = $_POST['qtytops'];(To make life easier, I've left off the opening and closing tags when looking at the code itself & I'll continue like that throughout this series.)

Each of these statements is an "assignment" instruction. 

The equal sign in the middle designates it as such and tells PHP to "make the value of this Equal to the value of that." 

In this case we're making the value of one variable equal to the value of another variable (a "variable" is a data element whose value can change, as opposed to a "constant" which is a data element whose value can not change.)


The variables on the left, $qtybases for example, are variable fields that are being dynamically defined by these statements. 

This means that no other statement was needed to create the variable $qtybases; it's being defined right here. 

Those variables are being set to the values of some "POST" variables. 

"POST" variables are those that are passed down from the preceding form by means of the POST method (remember the statement <FORM ACTION="processorder.php" method=post> in the form.) 

We'll get into more detail about these variables later; for now suffice it to say that this format, using the names that were used in the calling form, will pick up the variables being passed down.


Then there's that group of echo statements. "Echo" works like a "print here" command. 

Remember that the PHP processor is going to interpret the PHP code in this page and then send the page down to the client browser. 

Whatever the echo prints out becomes part of the resulting page. 

Each of these echo statements prints out the value of a variable and a text string enclosed in quotes. 


Look closely and you'll see a period between the two 

This tells PHP to concatenate the two strings (the value of the variable and the quoted string) together. 

Thus, if $qtybases has a value of 5 then the first echo statement will return this:

5 bases<br>

which, on the resulting web page, will show up as "5 bases" followed by a line break.

Try  it out on our example.


Variables hold one or another "type" of information.  PHP is "loosely typed," meaning that the type of information to be held in a particular variable can change on the fly. 

Changing on the fly means that if you start with a variable holding numerical data and use it in calculations, for example, and then write an instruction to put text into it, PHP will then consider it to be a text variable.

Here are the main data types used in PHP:

Integer whole numbers

Double real numbers

String strings of characters (text, etc.)

Boolean true/false

Array a set or group of variables of the same type

Object class instances (more later!)


An array needs a few words at this point. 

A simple example of an array would be a string array called $month. 

There could be twelve in the set and they could have the values January, February etc. 

To reference the first of the set we use an index value thus:


In our example this would refer to array element with a value of:



The index could also be a variable, thus:

$monthnum = 2;

echo $month($monthnum);

Assuming the array had been defined with the values descried in our example, this would echo:



You've probably heard of type casting, but maybe not the kind I'm thinking of here!  This has nothing to do with thespian arts - type casting in PHP means telling PHP to treat a variable of one type as if it was another (without actually changing its type.) 

It doesn't really matter right here why you'd want to do that - it'll become clearer later. 

For now, just take a look at this example:

$quantity = 0;$amount = (double)$quantity;

$quantity is set up as an integer with a value of zero. 

The next line treats $quantity as a double type and assigns its value to $amount. 

$amount is now a double with a value of zero and $quantity is still an integer with a value of zero.


In PHP you can even use a variable as the name of a variable.  Take a look at this:

$varname = 'quantity';

$$varname = 5;

The second line uses the $varname variable in the name of the variable being assigned the value of 5. 

Consequently the variable $quantity is assigned the value 5. 

It does exactly the same thing as:

$quantity = 5;


In PHP there are two types of expression for us to look at. One is something called a "regular expression", which is used in the manipulation of text.

We'll talk more about them later in the series.

The other is more mathematical in nature, expressing operations to be performed on values and variables.

Here's a simple example: c = a + b

Assuming a and b are numbers (remember data types?  -- the result would be different if they were strings -- more about that later) this expression would add a and b and put the sum into c (remember again, that the equals sign here makes this an assignment instruction.) 


The Concatenate Operator

I get in trouble all the time because I ask how this can be considered an "operator", but trust me, the world thinks it is!  The concatenate "operator" is a period (full stop to the English English!)  It simply says "join this to this", so that

$parta = "This is part one “

$partb = "of a sentence!“

print $parta.$partb

prints out "This is part one of a sentence!”


Combined Operators:

There are some combination operators that you may see used (or may use!)  There are those who argue that these combination operators provide an advantage because they reduce typing and reduce the final size of the code.  In my humble opinion, however, they don't represent the way that most of us think of things, and are therefore somewhat confusing.  See what you think.

You remember from earlier examples that = is an assignment operator:

$a = 5

assigns the value 5 to $a.   This assignment can be combined with some other operators like this:

$a += 5

If $a already had a value of 5, then after this instruction it would be 10, as if the full instruction was:

$a = $a + 5

Valid combinations include:  +=  -=  *=  /=


Precedence and Associativity.

Think about this operation:

$a = 7 - 4 + 1

If the minus happens before the plus, the result would be 4.  If the plus happens first, the result is 2.  Since predictability is essential, an order of precedence was established, along with something called associativity. 

The order of precedence establishes a "rank" for operators, where those with the highest rank will be evaluated first.  When there are several operators of the same rank, they will be processed from left to right if they are left associative, and right to left if they are right associative.  Some operators, such as the comparison operators, have neither left nor right associativity.


The increment and decrement operators  ( ++ and -- ) are right associative, while the others I have discussed here are left associative.  The order of precedence, from highest to lowest (with those of equal precedence on the same line) is as follows:

++  --*  /  %+  -|&&| |andxoror


You can override the order of precedence but wrapping part of an expression in parentheses.  The innermost parentheses are processed first, so that:

(7 - 4) + 1 will give a result of 47 - (4 + 1) will give a result of 2

2 + 3 * 3 will give a result of 112 + (3 * 3) will also give 11(2 + 3) * 3 will give a result of 15

1 + 3 + 3 * 2 will give a result of 101 + ((3 + 3) * 2) will give a result of 13(1 + (3 + 3)) * 2 will give a result of 14


The If Statement

The basic decision making statement, the "if" statement says "if this is true, do this, else do that".  Its format is like this:

if ( condition ){ do these instructions }else{ do these instructions }

and here's an example:

if ($age < 21){ print "Minor"; }else{ print "Adult"; }


It is also possible to add a condition to the "else" side by using "elseif" like this:

if ($temp > $idealtemp){ print "Add cold water" }elseif ($temp < $idealtemp){ print "Add hot water" }else{ print "Add more water" }


The For loop

You can create a loop by using a "for" loop construct (as it is known.)  The "for" statement says "for a value of x starting here, until the value of x meets this condition, and changing the value of x by this amount each time you process the loop, process this code".  This could use a little explanation!  Basically, x is going to serve as a counter. 

We give x a start value, for example 1. 

Then we specify a condition to test before we decide to process the block of instructions in the loop, for example x < 11. 

Finally, we specify an amount by which to change x at the end of processing the block of instructions, for example, increment by 1. 

In this example, the code would be run ten times, with x having a value of 1 the first time through, 2 the second, etc. The last time through it would have a value of 10. 


Here's its format:

for ( counter's initial value,  counter's condition test, counter's increment ){ do these instructions }

and here's an example

for ($count = 1; $count < 11; $count++ ){   $tot = 2 * $count;   print "2 times $count equals $tot ";}

This example prints out the two times table from two times one to two times ten.  It's worth taking special note of the fact that the test comes at the beginning of the loop -- that is, before the code block is run.  Hence the need for a test for "less than 11" in order to get the tenth iteration to run.


The "While" loop

Another loop construct is the "While" loop construct.  The for loop uses a counter to control the number of iterations of its code block, but the while loop can use any kind of condition.   There is an inherent danger here!  What happens if the condition always remains true? 

The code never stops running -- that's what! 

This is known as an infinite loop and the a sure sign of a programmer error. 

PHP allows a system administrator to defend their system against this kind of abuse of processor time by providing a time-out mechanism.  PHP scripts are typically limited to 30 seconds of execution time, and will quit with an error at that point.  It is an important part of the debugging process to ensure that you don't wind up with any infinite loops!  That having been said.....


A "while" statement says "while this condition is true, process this code" and its format is:

while ( condition ){ do these instructions }

Here's our two times table as a while loop:

$count = 1while ( $count < 11 ){   $tot = 2 * $count;   print "2 times $count equals $tot ";   $count = $count + 1;}


There is a couple of things to take particular notice of in this example.  Firstly, we had to include a separate statement to initialize the count data element because it is not part of the construct as it would be in a for statement. 

Remember that the condition in a while statement can be any condition -- I have used a counter type of condition only to show the comparison of this construct to the for construct. 

Secondly, and for the same reason, there has to be a statement in the code block to increment $count (I could also have used   $count++   or   $count += 1  -- I like the format I used the best because it seems the clearest to me.)


There is also a variant of the while loop that puts the test for the condition at the end, that is, after the code block has been processed. 

This, of course, means that the code block will always run at least once.  

This variant is the "do... while" loop and it says "do this code block, and while this condition is true, go back and do it again".  Its format is:

do{ these instructions}while ( condition );


Here's our two times table as a do while loop:

$count = 1do{   $tot = 2 * $count;   print "2 times $count equals $tot ";   $count = $count + 1;}while ( $count < 11 )


These options show you how you can create program execution loops in you PHP code.  Which one is the best to use depends on the particular type of execution requirement. 

You have to think a it about the flow of logic as you see it, and use the construct that most closely resembles what you need. 

Another thing to remember is that you can nest these constructs, by which I mean that the code block to be run by the construct could include another loop construct.  Any type of loop can be contained within any other type of loop.

When you include code within a loop like this it is a valuable thing to do to indent the code a couple of spaces like I have done in the examples above. 


What is a Function?

In the last part of this tutorial series we looked at controlling logic flow in PHP. 

This included logic flowing in a linear fashion, but with loops of logic at various points and with decision making along the way. 

The overall flow was a straight line - the loops were processed where they occurred, and the logic continued along its line from the beginning of the program routine to its end. 

There are times, however, when a series of instructions has to be repeated from a variety of different points within the main routine, or where a series of instructions needs to be followed that doesn't really fit within the main routine. 


Variable Scope and Lifetime

It's important to note that if you define a variable within a function, that variable is only available within that function; it cannot be referenced in another function or in the main body of your program code.  This is known as a variable's scope. 

The scope of a variable defined within a function is confined to that function -- in other words, it's local to that function.

If a function needs to use a variable that is defined in the main body of the program, it must reference it using the "global keyword, like this:

function AddingNumbers ( ){   global $sum = 2 + 2 }

$sum = 0Addnumbers ( )print "2 + 2 = ".$sum


While the scope of a variable defined in a function is local to that function, a variable defined in the main body of code has a global scope. 

The "global" keyword tells PHP to look for a variable that has been defined outside the function.

There is also the idea of a lifetime for a variable.  A variable defined within a PHP program script exists only while that script is running. 

When the script ends, the variable ceases to exist.  This seems pretty obvious! 

Now apply it to a function:  a variable defined within a function exists only while that function is being processed; when the function ends, the variable ceases to exist.    Ooooh!  Aaaah- yes!!


The usefulness of functions is greatly enhanced by the ability to pass information from the main body of code to the function and in the opposite direction, or between one function and another it is calling  Values that are sent to a function are called arguments.

Passing Argument to a Function

To define arguments that will be passed to a function, you provide a list of names for them between the parentheses in the function statement, like this:

function Myfunction ($arg1, $arg2)

and to pass values to the function as arguments by putting them between the parentheses following the function's name in the statement that calls it, like this:

$answer = Myfunction (3, 5)


A function returns a result to the calling code by using the "return: keyword, like this:

return $result;

When the return statement is processed, the function terminates and the value of the variable specified is returned to the calling code. 

The return statement only returns one variable -- if you need to return more than one value, you'd have to define and return an array (we'll be getting into arrays a little later in this series.)

You could have more than one return statement in your function if, for example, you had conditional logic (such as "if" statements) within your function, but only one of them will ever be processed (since processing it terminates the function!)


An Example

Here's an example of a couple of variables being passed to a function as arguments with a result returned:



<title>Function Arguments Example</title>



<h1>Showing a Volume</h1>

<br />


function CalcVol ($x, $y, $z)


$vol = $x * $y * $z;

return $vol;



$long = 3;

$wide = 4;

$high = 5;

print  "The volume of this object is " . CalcVol($long, $wide, $high) . " volumetric units.";




In this example you can see that a function called CalcVol is being defined, and that it receives three parameters, $x, $y & $z.  These are being used to specify the lengths of the three axes of a solid object, which the function multiplies together to determine the volume of the object.  The function then returns the volume to the calling code.

The function is being called from the middle of a print statement, which passes the three values contained in the variables $long, $wide & $high.  Thus the print statement will display the result of the calculation.


Lots more of this tutorial continuing at:



17.13.3 Processing form data

When the user submits a form (e.g., by activating a submit button), the user agent processes it as follows.

Step one: Identify the successful controls

Step two: Build a form data set 

A form data set is a sequence of control-name/current-value pairs constructed from successful controls

Step three: Encode the form data set 

The form data set is then encoded according to the content type specified by the enctype attribute of the FORM element.


Step four: Submit the encoded form data set 

Finally, the encoded data is sent to the processing agent designated by the action attribute using the protocol specified by the method attribute.

This specification does not specify all valid submission methods or content types that may be used with forms. However, HTML 4 user agents must support the established conventions in the following cases:

If the method is "get" and the action is an HTTP URI, the user agent takes the value of action, appends a `?' to it, then appends the form data set, encoded using the "application/x-www-form-urlencoded" content type. The user agent then traverses the link to this URI. In this scenario, form data are restricted to ASCII codes.

If the method is "post" and the action is an HTTP URI, the user agent conducts an HTTP "post" transaction using the value of the action attribute and a message created according to the content type specified by the enctype attribute.

For any other value of action or method, behavior is unspecified.

User agents should render the response from the HTTP "get" and "post" transactions.


17.13 Form submission

The following sections explain how user agents

submit form data to form processing agents.

17.13.1 Form submission method

The method attribute of the FORM element specifies the

HTTP method used to send the form to the processing agent.

This attribute may take two values:

get: With the HTTP "get" method, the form data set is

appended to the URI specified by the action attribute

(with a question-mark ("?")

as separator) and this new URI is sent to the processing agent.

post: With the HTTP "post" method, the form data set is included

in the body of the form and sent to the processing agent.

The "get" method should be used when the form is idempotent

(i.e., causes no side-effects). Many database searches have no visible side-effects and make ideal applications for the "get" method.

If the service associated with the processing of a form causes side effects (for example, if the form modifies a database or subscription to a service), the "post" method should be used.