| iMatix home page | << | < | > | >> |
![]() Version 1.91 |
#include "sflhttp.h" char * cgi_fld_by_index ( int iPos, char *strIn, char *strRetBuf, char *strFldName )
Gets field data from a CGI input stream based off a field index. The index is from 0 to n. Where 0 would be the first field in the stream, and n would be the last. This function returns the HTML form field name and the value of the field. example: Form snippet: E-mail: <INPUT TYPE="text" NAME="Email" SIZE=80> CGI code to get form field: cgi fld by index ( 1, strStdin, strFldValue, strFldName ); On return from the call: strFldValue would = "v1.4" and would strFldName be = "VERSION" Submitted by Scott Beasley jscottb@infoave.com
{ int iLen; char *strTmp; ASSERT ( strIn ); *strRetBuf = ( char ) NULL; iLen = getstrfldlen ( strIn, iPos, 0, "&" ); if ( iLen ) { strTmp = ( char * ) malloc ( sizeof ( char ) * iLen + 1 ); getstrfld ( strIn, iPos, 0, "&", strTmp ); getequval ( strTmp, strRetBuf ); http unescape ( strRetBuf, NULL ); if ( strFldName ) getstrfld ( strTmp, 0, 0, "=", strFldName ); free ( strTmp ); } return strRetBuf; }
| << | < | > | >> |
![]() |