HTML and CSS Reference
In-Depth Information
A Web page invokes server-side processing by either an attribute on a form or by a
hyperlink—the URL of the script is used. Any form data that exists is passed to the
script. The script completes its processing and may generate a confirmation or response
Web page with the requested information. The Web server returns this page to the Web
browser. Every time you perform a search using Yahoo! or other search engines, you are
using server-side processing.
Steps in Utilizing Server-Side Processing
1. Web page invokes server-side processing by a form action attribute or by a
hyperlink.
2. Web server executes a server-side script.
3. Server-side script accesses requested database, file, or process.
4. Web server returns Web page with requested information or confirmation of
action.
When invoking a server-side script, the Web developer and the server-side programmer
must communicate about the form method attribute ( get or post ), form action attri-
bute (URL of the server-side script), and any special form element control expected by
the server-side script. The value of the name attribute on each form control is passed to
the server-side script and may be used as a variable name in the server-side processing.
In the next Hands-On Practice, you will invoke a server-side script from a form.
HANDS-ON PRACTICE 9.4
In this Hands-On Practice you will modify the contact.html page that you created earlier
in this chapter, configuring the form so that it uses the post method to invoke a server-
side script. Please note that your computer must be connected to the Internet when you
test your work. The post method is recommended by the W3C and is more private than
the get method. The post method does not pass the form information in the URL; it
passes it in the entity-body of the HTTP Request, which makes it more private.
When using a server-side script you will need to obtain some information, or documen-
tation, from the person or organization providing the script. You will need to know the
location of the script, whether it requires any specific names for the form controls, and
whether it requires any hidden form elements. The action attribute is used on the
<form> tag to invoke a server-side script. A server-side script has been created at
http://webdevfoundations.net/scripts/formdemo.asp for students to use for this exercise.
The documentation for the server-side script is listed in Table 9.13.
Table 9.13 Server-side script documentation
Location of Script:
http://webdevfoundations.net/scripts/formdemo.asp
Purpose of Script:
Use the method="post" when invoking this script. This script will accept form input
and display the form control names and values in a Web page. This is a sample script for
student assignments. It demonstrates that server-side processing has been invoked. A
script used by an actual Web site would perform a function such as sending an e-mail
message or updating a database.
 
Search WWH ::




Custom Search