HTML and CSS Reference
In-Depth Information
9.12.3. Handling POST Forms
Forms-processing applications that accept HTML/XHTML POST-style
parameters expect to read encoded parameters from their standard in-
put. Like GET-style applications with named parameters, they can take
advantage of the server's utility routines to parse these parameters.
Here is a program that echoes the POST-style parameters back to the
#include <stdio.h>
#include <stdlib.h>
#define MAX_ENTRIES 10000
typedef struct {char *name;
char *val;
} entry;
char *makeword(char *line, char stop);
char *fmakeword(FILE *f, char stop, int *len);
char x2c(char *what);
void unescape_url(char *url);
void plustospace(char *str);
main(int argc, char *argv[])
{ entry entries[MAX_ENTRIES];
int num_entries, i;
/* Parse parameters from stdin, building a table of entries */
for (num_entries = 0; !feof(stdin); num_entries++) {
entries[num_entries].val = fmakeword(stdin, '&', &cl);
entries[num_entries].name =
makeword(entries[num_entries].val, '=');
Search WWH ::

Custom Search