mod_form 1.0 review

Download
by rbytes.net on

mod_form is a utility to decode data submitted from Web forms

License: GPL (GNU General Public License)
File size: 8K
Developer: Nick Kew
0 stars award from rbytes.net

mod_form is a utility to decode data submitted from Web forms. It deals with both GET and POST methods where the data are encoded using the default content type application/x-www-form-urlencoded.

mod_form does not decode multipart/form-data (file upload) forms: for those you should use mod_upload.

Usage:

When mod_form is active, form data will be decoded to an apr_table_t*. Modules can access the table using the optional function form_data, or individual form fields using form_value:

#include "mod_form.h"

some_func(request_rec* r) {
apr_table_t* (*form_vars)(request_rec*) ;
apr_table_t* (*form_lookup)(request_rec*, const char*) ;
apr_table_t* form_data ;
const char* val ;
const char* key = "some-form-field" ;

/* get the whole table */
form_vars = APR_RETRIEVE_OPTIONAL_FN(form_data) ;
if ( form_vars ) {
form_data = form_vars(r) ;
}

/* or get individual values */
form_lookup = APR_RETRIEVE_OPTIONAL_FN(form_value) ;
if ( form_lookup ) {
val = form_lookup(r, key) ;
}
}

Requirements:
Apache

mod_form 1.0 search tags