| iMatix home page | << | < | > | >> |
![]() Version 1.91 |
#include "sflhttp.h" char * cgi_fld_by_name ( char *strFld, char *strIn, char *strRetBuf )
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: 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
{ int iCnt = 0, iLen; char *strTmp; ASSERT ( strFld ); ASSERT ( strIn ); trim ( strFld ); *strRetBuf = ( char ) NULL; while ( 1 ) { 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 = ( char * ) NULL; } return strRetBuf; }
| << | < | > | >> |
![]() |