04.06.2013 Views

Head First HTML with CSS

Head First HTML with CSS

Head First HTML with CSS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

How forms work<br />

in the browser<br />

To a browser, a form is just a bit of X<strong>HTML</strong> in a<br />

page. You’ll see that you can easily create forms in<br />

your pages by adding a few new elements. Here’s how<br />

a form works from the browser’s perspective:<br />

The browser loads the page<br />

The browser loads the X<strong>HTML</strong> for a page<br />

like it always does, and when it encounters<br />

form elements, it creates controls on the page<br />

that allow you to input various kinds of data. A<br />

control is just something like a button or a text<br />

input box or a drop down menu – basically<br />

something that allows you to input data.<br />

You enter data<br />

You use the controls to enter data. Depending<br />

on the type of control, this happens in<br />

different ways. You can type a single line of<br />

text into a text control, or you might click one<br />

option of many in a checkbox control. We’ll<br />

look at the different kinds of controls shortly.<br />

You submit the form<br />

You submit the form by clicking on a submit<br />

button control. That’s the browser’s cue that it<br />

needs to package up all the data and send that<br />

data off to the server.<br />

The server responds<br />

Once the server has the form data, it passes<br />

it off to the appropriate Web application<br />

for processing. This processing results in a<br />

brand new X<strong>HTML</strong> page that is returned to<br />

the browser, and since it’s just X<strong>HTML</strong>, the<br />

browser displays it for you.<br />

xhtml forms<br />

you are here 593

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!