Sams Teach Yourself HTML, CSS & JavaScript Web Publishing in One Hour a Day

(singke) #1
ptg16476052

Understanding Form and Function 315

12






Next, add your title so that people will understand the purpose of the web page:


Please Log In

And don’t forget to include a title in the body of the page:


Please Log In


Within the body of the web page, add a form element. I’ve added both the opening and
the closing tags, with an empty line between them, so that I don’t forget to close the form
when I’m finished :




Before continuing, you need to know more about the form element and the attributes you
see within the opening tag. Obviously, form begins the element and indicates that you’re
creating an HTML form. The action attribute specifies the URL to the server-side script
(including the filename) that will process the form when it’s submitted. It’s important
that the script with the name you’ve entered is present on your web server at the location
the URL specifies. In this example, I use the full URL for the script, but you can just as
easily use a relative URL if it makes more sense.



Before going live with forms , contact your web hosting provider
and ask whether you can use the hosting provider’s scripts or add
your own. You must also determine the URL that points to the
directory on the server that contains the scripts. Some hosting
providers rigidly control scripts for security purposes and won’t
allow you to create or add scripts to the server. If that’s the case,
and you really need to implement forms on your web pages, con-
sider searching for a new hosting provider.

CAUTION

The next attribute is method, which can accept one of two possible values: post or get.
These values define how form data is submitted to your web server. The post method
includes the form data in the body of the form and sends it to the web server. The get ▼

Free download pdf