Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added README

Explains the operation and differences/benefits versus the functional
version.
  • Loading branch information...
commit ceef57e7b05ee00c1a8c030099b06ac031bb6793 1 parent 3d2768b
FwrMedia authored
Showing with 34 additions and 0 deletions.
  1. +34 −0 README
View
34 README
@@ -0,0 +1,34 @@
+branch form_handler_class
+
+Operates almost exactly like the functional code except for an important addition.
+
+Usage:
+
+ require(DIR_WS_CLASSES . '/form_handler.php');
+ $formHandler = new form_handler();
+
+ if (($extracted = $formHandler->setRequiredFormKeys(array())
+ ->setOptionalFormKeys(array()
+ ->validate()) !== false) {
+ extract($extracted,EXTR_OVERWRITE);
+
+###########################################################
+
+In complex files like address_book_process there are _POST variables that are always present
+but also there are variables that are only introduced in certain conditions e.g.
+
+if (ACCOUNT_GENDER == 'true')
+
+This system handles that by: -
+
+setRequiredFormKeys() - is passed an array of "required to be present" _POST keys.
+
+setOptionalFormKeys() - is passed a full array of optional _POST keys
+
+The required keys are used along with the sessiontoken when validating the form.
+
+The optional keys are extracted from _POST if they happen to be present and their values are typecast
+along with the required key=>value(s)
+
+This allows a lot of flexibility, reduction of core code, reduction of code complexity and the definate
+knowledge that all variables extracted have been typecast and sanitised.
Please sign in to comment.
Something went wrong with that request. Please try again.