HTML and CSS Reference
In-Depth Information
printf("Content-type: text/html\n");
printf("\n");
printf(<html>);
printf(<head>);
printf("<title>Named Parameter Echo</title>\n");
printf("</head>");
printf(<body>);
printf("You entered the following parameters:\n");
printf("<ul>\n");
/* Echo the parameters back to the user */
for(i = 0; i < num_entries; i++)
printf("<li> %s = %s\n", entries[i].name,
entries[i].val);
/* And close out with more boilerplate */
printf("</ul>\n");
printf("</body>\n");
printf("</html>\n");
}
The example program begins with a few declarations that define the util-
ity routines that scan through a character string and extract the para-
meter names and values. [*] The body of the program obtains the value
of the QUERY_STRING environment variable using the getenv( ) system
call, uses the utility routines to extract the parameters from that value,
and then generates a simple HTML document that echoes those values
back to the user.
[*] These routines are usually supplied by the server vendor. They are not part of the standard C or
Unix library.
For real applications, you should insert your actual processing code after
the parameter extraction and before the HTML generation. Of course,
you'll also need to change the HTML generation to match your applica-
tion's functionality.
 
 
Search WWH ::




Custom Search