Back Pain Relief 4 Life Coaching Sessions

Programming with HTML Forms

Programming with HTML Forms
A drawback with the basic features of HTML is their lack of support for writing documents which interact with the user. Interaction in many documents consists of the user deciding which hypertext link to follow next.
Fortunately, HTML 2.0 includes forms, which means that a document can utilize text entry fields, radio boxes, selection lists, check boxes, text areas, hidden fields, and buttons. These can be used to gather information for an application 'behind' the document, to guide what is offered to the user next. Some typical forms documents are: a movie database questionnaires, surveys, and pizza delivery (Pizza Hut's PizzaNet
This article details three stages in writing forms-based applications for Netscape Navigator for X Windows version 2.0. However, the approach is applicable to all Web browsers with forms capabilities.
The first example prints out the values entered in the fields of a form. The second searches through a text file for matching strings entered via a form. Both examples utilize C programs to process the form's data.
The article finishes with brief discussions of forms testing, and techniques for logging form usage.
Programming with HTML Forms
There are three basic stages to programming a forms-based document:
1. Design the input form, and write the corresponding HTML document.
2. Write the application program which interprets the data from the input form.
3. Design the document which is generated by the program as the reply to the user. Usually, this document is written in HTML, but this is not mandatory.
Pictorially, these three stages are related as shown below:

Programming with HTML Forms
Before a forms application can be described, the HTML features for defining forms need to be reviewed.
A form begins with:
and ends with:
The METHOD attribute specifies how the data entered in the various fields of the form is transmitted to the application. It is best to use the POST method, since the data is then sent to the standard input of the application, as a string of the form:
name is the name of the form's data entry field, while value is its associated data.
The other method for sending data is GET. This causes the string to arrive at the server in the environment variable QUERY_STRING, which may result in the string being truncated if it exceeds the shell's command line length. For that reason, GET should be avoided.
A form can contain 8 types of data entry field:
• single line text entry fields
• check boxes
• radio boxes
• hidden fields
• password fields
• selection lists
• multi-line text entry fields
• submit and reset buttons
Single line text entry fields, hidden fields, password text fields, check boxes and radio boxes are specified using the same basic HTML syntax:
field-type can be either: text, checkbox, radio, hidden, or password.
For a check box or radio button, the VALUE field specifies the value of the field when it is checked; unchecked check boxes are disregarded when name=value substrings are being posted to the application.
If several radio buttons have the same name then they act as a one-of-many selection: only one of them can be switched 'on', and so have its value paired with the name.
A hidden text field does not appear on the form, but can have a default value which will be sent to the application.
A password text field will echo *'s when a value is typed into it.
A selection list is specified using:

The option chosen will become the value associated with the selection list's name. It is also possible to include the attribute MULTIPLE after the NAME string to allow multiple selections. This maps to multiple name=value substrings, each with the same name.
A multi-line text entry field has the form:

The submit button causes the document to collect the data from the various form fields, pair it with the names of the fields, and post it to the application. The reset button resets the fields to their default values. Button syntax is:

Thirteen form examples are accessible through:

overview.html also contains more details on the syntax of form fields.
Programming with HTML Forms
As mentioned before, when the submit button is clicked, the POST method causes a string to be sent to the application. The string consists of a series of name=value substrings, separated by &'s. An added complication is that name and value are encoded so that spaces are changed into +'s, and some characters are encoded as hexadecimals. Fortunately, form application programmers have written routines for handling these coded strings.
The POST method means that the form application will receive the string on its standard input. This protocol is defined by the Common Gateway Interface (CGI) specification, which also states that an application can respond by generating suitable code on its standard output. Details on the CGI specification can be found at:
The CGI specification permits an application to output many different types of documents (e.g. an image, audio, plain text, HTML, or references to other documents). The application determines the output type by writing a header string to standard output, of the form:
Content-type: type/subtype
type/subtype must be MIME (Multipurpose Internet Mail Extensions) types; two common ones are text/html for HTML output, and text/plain for ASCII text. There must be a blank line after the header, and then the data can begin. For instance, an application (coded in C) could output the following:
printf("content-type: text/html\n\n");
/* the newlines are necessary for the blank line */
Search String Error!
printf("Must specify at least 1 pattern
Example 1: The Echoer
Programming with HTML Forms
Having described the HTML form constructs, the mechanism for supplying data to a form application, and the mechanism for generating a reply, it is now possible to describe a complete, very simple example. Its input document consists of a form with five single line text entry fields, which the application processes by outputting a HTML document containing the text entered in the fields. In other words, the user's input is echoed.
The input document is located at:
It will also be used as the interface to the file searcher application of the next section. However, ignoring the explanatory text, the form is quite simple: five text entry fields, and submit and reset buttons labelled as 'Start Search' and 'Clear' respectively.
The text field constructs include extra attributes to limit the size of the input, and the size of the boxes drawn on the screen. Also note that the fields are named pat1 through pat5, although these are not displayed as part of the input document.
When the input document is entered as in Figure 2 and the 'Start Search' button is clicked, the echoing application returns the document shown in Figure 3.
ALP Membership Search

• Enter at most 15 characters in a box (e.g. Melbo).
• At least one box should contain something.
• Matches are lines in the membership list which contain all the box entries.
• The first 10 matches will be returned, together with the total number of matches.
• Click the Start Search button to start the search.
• All the boxes can be cleared by clicking on the Clear button.

Search Boxes

Figure 2: Example input
Query Result
You submitted the following name/value pairs:
• pat1 = John
• pat2 = uk
• pat 3 =
• pat 4 =
• pat 5 =
Figure 3: Echoed input from Figure 2
In form-gp0.html, the name of the application is given in the FORM ACTION attribute as:
qgp's actual location on the server depends on the configuration file for the httpd daemon (called httpd.conf). The relevant line in that file is:
Exec /cgi-bin/* /local/dept/wwwd/scripts/*
In other words, qgp must be placed in /local/dept/wwwd/scripts in order for the form to invoke it. This step in linking the input HTML document to the application varies from system to system.
qgp is the object file for qgp.c which can be found at:
The program mostly consists of utility functions for processing name=value substrings, which will, consequently, appear in almost every form application. Some of the functions were written by Rob McCool, and can be accessed via the page:
Also available from that page are similar utilities for writing applications in the Bourne Shell, Perl, and Tcl. Also included are several excellent small programs showing how the utilities can be used.
qgp begins by outputting the start of the reply document -- a HTML document in this case. The extra newlines in the printf()'s are not required, but make the output easier to read during debugging (see Part 7, 'A Note on Testing' for more on this).
cgi_errs() performs two standard error checks: the first determines whether the delivery METHOD is something other than POST. The second checks the encoding strategy for the name=value substrings. In fact, the only encoding supported by most browsers is x-www-form-urlencoded.
The call to build_entries() initializes the entries array with the name and value pairs sent to the application. The environment variable, CONTENT_LENGTH, contains the length of the string, which is used by the for-loop that builds the entries array. Each name=value substring is extracted by a call to fmakeword(). The +'s and hexadecimal URL encodings are replaced, and then the name part of the substring is removed, leaving only the value.
Finally, the contents of the entries array are output as an unnumbered HTML list.
Both cgi_errs() and build_entries() illustrate the importance of environment variables for conveying information from the input document to the application. A complete list of environment variables supported by the CGI specification can be found in:
Example 2: The File Searcher
Programming with HTML Forms
The input document for the file searcher has the same format as before, but can be found at:
The only change is that its form's ACTION attribute refers to "".
qdir searches through a text file holding a membership list. It looks for lines containing the strings entered in the text entry fields of the form, and at most 10 matching lines are printed, together with the total number of matching lines.
The query like the one shown in Figure 2 results in the HTML document shown in Figure 4 being generated by the application. It can also produce an error document, as shown in Figure 5, if no strings are entered before a search is initiated.
Query Result
Only a maximum of 10 matching lines are shown for any search.
The following strings are being used for the search:
• John
• uk
The lines found are:
• Bell, John; DoCS; Queen Mary and Westfield College; Mile End Road; London E1 4NS; UK; Tel: 071 975 5210; Email:
• Fox, John; ICRF; Advanced Computation Laboratory; PO Box 123,; Lincoln's Inn Fields; London WC2A 3PX; UK; Tel: 071 269 3624; Email:
• Johns, Nicky; LPA; Studio 4; Royal Victoria Patriotic Building; Trinity Road; London SW18 3SX; UK; Tel: 081 871 2016; Fax: 081 874 0449; Email:
• Jones, John; DoCS; Univ. of Hull; Hull; HU6 7RX; UK; Tel: 0482 465767 or 465951; Email:
• Lloyd, John; Dept of CS,; Univ. of Bristol; Queen's Building,; Univ. Walk; Bristol BS8 1TR; UK; Tel: 0272-303913; Email:
5 line(s) printed.
Figure 4: Reply to input like that in Figure 2
Query Result
Must specify at least 1 pattern
Figure 5: Error reply if no strings supplied
The application C code (in file qdir.c) can be found at:
The compiled version, qdir, is in /local/dept/wwwd/scripts.
qdir begins in a similar way to qgp by outputting the start of its reply HTML document and then checking for CGI errors.
The call to record_details() is explained in Part 8, 'Logging'. It logs information about the user in a file, and has no effect on the subsequent code.
get_pats() initially calls build_entries() to obtain the name=value pairs in a useable form. The values are then extracted and placed in the patterns array. These values correspond to the search strings entered by the user in the form's text entry fields.
print_pats() prints the search strings as an unnumbered HTML list.
process_pats() uses the search strings to form a UNIX command. The idea is to translate a single search string, such as John, into the command:
fgrep 'John' search-file > temp-file
fgrep is a UNIX utility for quickly searching through text files.
Multiple search strings, such as John, uk, and LPA, would be utilized in the following command:
fgrep 'John' search-file | fgrep 'uk' | fgrep 'LPA' > temp-file
The trick is to pipe the matching lines of one fgrep call into another fgrep call, which further filters the selection.
The matching lines are printed by print_matches(), which reads at most 10 lines from the temporary file.
The total number of lines in the temporary file is counted by the wc UNIX command:
wc -l temp-file
The line count is read in via a pipe which captures the output from the command.
This code demonstrates how to utilise UNIX features as part of an application, which is preferable in this case because of the size of the file being searched, and the potentially large number of matching lines that need to be manipulated. These techniques for utilizing UNIX can also be employed to create forms that edit files, send mail, read news, or monitor the network.

Make the Big Sites Work for You

Make the Big Sites Work for You
Amazon and Google are more than just Web sites--they're gigantic collections of useful data. The application programming interfaces (APIs) that access that data have enabled developers to build other amazing sites, and you can too if you're willing to hack a little code. has more than 80,000 developers who use its API to build online shopping malls, as well as sites like Live Plasma, where you can search on a musician and view a groovy map showing related artists.
"We invite developers to be creative and innovative," says Amazon Web services evangelist Jeff Barr, "to take our data and do fun things with it."

It's not just Amazon. Dreamworks animator Paul Rademacher has combined data from Google Maps and Craigslist to create an interactive map that lets you find housing in markets across the country. FlickrPaper employs Flickr's API to let users build desktop wallpaper from Flickr's shared photo collection. First Floor Software used a Yahoo API to create an image search engine that displays results as a slide show. The Send to Smug Mugplug-in enables users of to send pics directly to the digital photography site by right-clicking an image inside Windows Explorer. And that's just a tiny sample of what's available.
To take advantage of a site's API, you need some knowledge of common Web programming tools. Google's downloadable API kit contains a manual on how to use it, along with sample Java and .Net code. Flickr provides a wealth of APIs, as well as code samples. You'll find documentation and more for Amazon's APIs here; Yahoo's ishere.
Even if you're not a code jockey, you can add Google or Amazon to your site. Simply copy a dozen lines of HTML code to add a Google search box to your home page. Selling Amazon products on your site for up to a 10 percent commission is nearly as easy. You'll have to sign up for the Amazon Associates program and copy some code to your home page. Then just wait for the money to roll in

Profit from the desktop

Profit from the desktop
Why venture out on the Net when it can come to you? You can festoon your desktop with "widgets" that pull information from your favorite Web sites.
The best-known widget program is Pixoria's Konfabulator ($25). [Editor's note: Yahoo bought Konfabulator in July 2005 and now offers it for free. Download a copy here.] It comes with more than a dozen prefab widgets, which run the gamut from practical (clocks, stock tickers, battery and Wi-Fi monitors) to whimsical (a "werewolf" widget that displays the phases of the moon). But the real widget wonderland is Pixoria's site, where users contribute their own creations for free. Here you'll find traffic and surf cams, train schedules, radio and RSS tuners, meters that display the locations of the cheapest gas in your area, an English-to-Swedish translator, a haiku generator, a Shakespearean Insult Kit, and the unblinking red eye of the HAL 9000 computer from 2001: A Space Odyssey, complete with sound bites. And all that is just for starters.

To add a new widget to your desktop, right-click the Konfabulator icon in your system tray and select Open Widget. To download more items from the site, select Get More Widgets. To view all your widgets at once, selectKonspose. It doesn't get much simpler.
Stardock's DesktopX 3 ($15) features 23 widgets, including a language translator and an applet that can fetch the lyrics of virtually any song you might have a hankering to hear. The Standard ($25) and Professional ($70) versions come with tools that let you build your own widgets or overhaul your entire Windows desktop. Another place to find free stand-alone widgets, from clocks and calendars to abstract art generators, is at the Freeware Guide.

Things You Didn't Know You Could Do on the Internet

Things You Didn't Know You Could Do on the Internet
The Web is learning new tricks every day. These surprising sites and services will help you solve problems and save time--and one might even make you a star.
Make $$ From Your Site
ust because you missed the dot-com boom doesn't mean the gravy train has passed you by completely. Here are a handful of ways you can make your Web site pay for itself and maybe bring in a little bit of extra cash as well.
• Text ads:Programs like Google AdSense let you carry text ads relevant to your site's content. Every time a visitor views or clicks an ad, you'll earn a few pennies.
• Affiliate programs:Many online merchants depend on networks of affiliate sites to move product. Affiliate aggregators like LinkShare or Commission Junction let you pick from hundreds of affiliate advertisers, some offering commissions as high as 40 percent.
• Subscriptions:Is your Web content worth paying for? You could charge users for access. But be aware that subscription management services like VisionGate or MemberGate can cost from a few hundred to several thousand dollars a month, depending on the number of subscribers.
• Self-publishing:Aaron Gleeman, editor in chief of the Hardball Times baseball site, used a more traditional method of generating income from his hobby. He published a couple of books, including The Hardball Times Baseball Annual, through Lulu Press. The royalties allow him to pay his writers a small stipend and to make a comfortable if not cushy living.
Contributing Editor Dan Tynan is the author of Computer Privacy Annoyances(O'Reilly Media, 2005). He also writes PC World's Gadget Freak column

How to choose online retailer

How to choose online retailer ?
The recession brought lots of competition between retailers. There are also more and more consumers looking for ways to cut budget

Now more and more online businesses do looking for ways to cut costs. But there are several other things that clients consider when they choose online store—besides price. These attributes are as follows:

Cost: Cost is one of the important things consumer consider when choosing a online store, but they should be aware that store is a business as well—and office managers of online stores are looking to earn profit on resources that could be offered for free. In other words, if a company offers extremely low prices, that could be indicative of low quality work.

Previous Clients: To see if the chosen store is capable of doing a great job, the consumer can look at others’ choices. If many others choose the same store for their needs, that’s a good sign. When doing research, keep in mind that it is easy to track feedback on a consumer websites.

History: It is easy to see if a online company is reputable by looking at its history and progress over time. Better volumes and an active, wide customer base indicates that the company employees have the right skills.

Development: Technology advances so fast quickly that not many stores are able to keep up with it. People who enjoy and are devoted to their profession not only stay up-to-date, but also tell others what’s coming next in their field. So in other words, it is smart to look what technology a store uses—and if there are signs that the office is a pioneer in its industry, then it is probably the right place to make a purchase.

So if a consumer is going to look for the right online store, they must verify the above items to ensure the highest quality service for their needs.

How one can protect your teething baby

How one can protect your teething baby
Your child start teething

Once your little little one begins teething they might try to know down on the perimeters of the Crib Rail. The Crib Rail Cover was created to safeguard your teething toddler child from the damaging problems, which can happen from chewing upon the edges of the Crib Rail. The sides of a Teething Rail are often made from a strong material. A Crib Rail Cowl was made to cover this hardened materials and to cushion it. The Rail sides of the Crib are normally handled with a varnish or some other type of paint. This might presumably hurt your baby.

All infants react and reply otherwise to the teething stage, but chewing is a factor that every one teething infants really enjoy doing that and teething is a very important second for babies. The Crib Rail furnishes teething children with the right chewing opportunity. The Crib Rail Cover will assist you to and your child during this time period. It's essential to make sure that you purchase the proper kind of Crib Rail Cover. When you decide to purchase a Crib Rail Cover it is very essential that you make certain that it is fabricated from a gentle fabric. One can find that some Crib Rail Covers are made from a pliant plastic. It's doable that this could cover the wood part of the rail, however it may be too stable and it might nonetheless injure your tot's new teeth.

Teething tots take pleasure in biting on things and a crib rail cover is a very inexpensive merchandise that it would be best to buy just to be safe. The Crib Rail Cowl gives the right testing ground for brand spanking new infants to follow using their new teeth. At instances teething tots will stand in the child crib and chaw on the sides of the Crib Rail and that is really not safe. Through the teething stage it's possible you'll notice that the tiny infant can unexpectantly chip their teeth on the Teething Rail. The Crib Rail Cover will assist cease these accidents from happening. The Crib Rail Cowl is designed to assist safeguard your teething tiny infant from damaged wooden and dangerous varnish.

How to organize properly baby furniture

Listed here are some useful suggestions to help you.

Place the changing desk close to the doorway of the room. It's more handy whereas bringing the infant from different places of the house for changing.

Place other furnishings near the outlet. Outlet is the space where you possibly can keep a lamp and baby monitor, also known as child alarm.

You possibly can place some ornamental objects on the outlet as well. One thing you might want to learn about is that the outlet ought to seem to your baby from the crib in order that when the child wakes up, he/she will observe those issues instead of simply crying or wailing.

Keep the nursery glider or rocker close to the crib and no more than three toes away. There will likely be enough house between the crib and glider for straightforward movement.

Additionally, the space between the crib and glider should not be too lengthy apart so that the sleeping child shall be placed again to the crib without any disturbance. If you place the crib in the halfway of the wall, then locate the rocker at one corner.

Don’t place the crib beside the wall that is subsequent to the lavatory or every other room that may create a variety of sounds and noises. The wall should not be close to to a loud avenue or neighbor as properly, it's because the noise will maintain the infant from resting and when he/she doesn’t relaxation, you too received’t have one.

Don't find the child crib beneath the home windows, for plenty of child died falling from window cases throughout the state have been reported yearly as a result of such imbecile action.
Source: Free Articles from