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

 

cgi_fld_by_name

#include "sflhttp.h"
char *
cgi_fld_by_name (
    char *strFld,
    char *strIn,
    char *strRetBuf)

Synopsis

Gets field data from a CGI input stream based off a HTML form field name. This function returns the value of the form field. example: Form snippet: Product <INPUT TYPE="text" NAME="SENDERID" SIZE=80 VALUE="mailto"> Version <INPUT TYPE="text" NAME="VERSION" SIZE=80 VALUE="v1.4"> E-mail <INPUT TYPE="text" NAME="Email" SIZE=80> CGI code to get form field: cgi fld by name ("VERSION", strStdin, strVersion); On return from the call: strVersion would = "VERSION" Submitted by Scott Beasley jscottb@infoave.com

Source Code - (sflhttp.c)

{
    int iCnt = 0, iLen;
    char *strTmp;

    ASSERT (strFld);
    ASSERT (strIn);

    trim (strFld);
    *strRetBuf = (char) NULL;
    FOREVER
      {
        iLen = getstrfldlen (strIn, iCnt, 0, "&");
        if (!iLen)
            break;

        strTmp = (char *) malloc (sizeof (char) * iLen + 1);
        getstrfld (strIn, iCnt++, 0, "&", strTmp);
        if (!lexncmp (strFld, strTmp, strlen (strFld)))
          {
            getequval (strTmp, strRetBuf);
            http unescape (strRetBuf, NULL);
          }
        if (strTmp)
            free (strTmp);
        strTmp = NULL;
      }
    return strRetBuf;
}

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