HTML and CSS Reference
In-Depth Information
/* Spit out the HTML boilerplate */
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");
}
Again, we follow the same general form. The program starts by declar-
ing the various utility routines needed to parse the parameters, along
with a data structure to hold the parameter list. The actual code begins
by reading the parameter list from the standard input and building a list
of parameter names and values in the array named entries . Once this
is complete, a boilerplate document header is written to the standard
output, followed by the parameters and some closing boilerplate.
Like the other examples, this program is handy for checking the para-
meters being passed to the server application early in the forms- and
application-debugging process. You can also use it as a skeleton for oth-
er applications by inserting appropriate processing code after the para-
meter list is built up and altering the output section to send back the
appropriate results.
 
Search WWH ::




Custom Search