| iMatix home page
| << | < | > | >>
SFL Logo SFL
Version 2.11

 

displayform

#include "sflhttp.h"
int
displayform (
    char *strformfile,
    char *strvalues)

Synopsis

Writes a HTML file out to the web browser or another file. Gives the option to have replaceable parameters in your HTML. Form snippet: Product <INPUT TYPE="text" NAME="SENDERID" SIZE=80 VALUE="%PRONAME%"> Version <INPUT TYPE="text" NAME="TOIDS" SIZE=80 VALUE="%PROVER%"> E-mail <INPUT TYPE="text" NAME="Email" SIZE=80> This would/could be a string you build at runtime: char *strformparms = "%PRONAME%|mailto,%PROVER%|v1.4"; char *strfilename = The full path to the HTML file to display. This will read the file and do any string replaces it needs to and then send it out to the browser, or file with the changes. displayform (strfilename, strformparms); Submitted by Scott Beasley jscottb@infoave.com

Source Code - (sflhttp.c)

{
    FILE *fp;
    char strline [1025];

    ASSERT (strformfile);

    fp = fopen (strformfile, "r");
    if (!fp)
        return 1;

    while (!feof (fp))
      {
        fgets (strline, 1024, fp);
        strcrop (strline);
        if (*strvalues)
            stringreplace (strline, strvalues);
        puts (strline);
      }

    fclose (fp);
    return 0;
}

| << | < | > | >> iMatix Copyright © 1996-2000 iMatix Corporation