home support FAQ resources services partners contact us contact us
 Web Application Previous  Next  
 Tutorial

$template->assign(“EMAIL_VALUE”, isset($form[“email”]) ? $form[“email”] : “”);
$template->assign(“NAME_ERROR”, sprint_error($errors[“name”]));
$template->assign(“EMAIL_ERROR”, sprint_error($errors[“email”]));
// Print the template
$template->easy_print() or die($template->error);

Tip: $REQUEST_METHOD is obviously a variable of global scope and thus not available
inside functions.You can access it there using the $GLOBALS array with
$GLOBALS[“REQUEST_METHOD”] or by doing a global $REQUEST_METHOD;.
The submitted data is validated for syntactical correctness using two functions from
the file String_Validation.inc.php3, which provides some commonly used string
validation functions (see Table 5.1).When an error in the submitted data is found, an
appropriate error message is inserted into the associative array $errors.This helps later
to determine whether an error had been found—if count($errors) is greater than 0,
the application reacts accordingly and doesn’t process the form.
Table 5.1 String Validation Functions from String_Validation.inc.php3

Function Purpose

is_alpha() Checks whether a string contains only alphabetic
characters; optionally checks for minimum and
maximum length.
is_numeric() Checks whether a string contains only numeric
characters; optionally checks for minimum and
maximum length.
is_alphanumeric() Checks whether a string contains only alphanumeric
characters; optionally checks for minimum and
maximum length.
is_clean_text() Checks whether a string contains an extended set of
characters that may occur in Western alphabet names
(includes all alphabetic characters, umlaut characters, all
kinds of quotes); optionally checks for minimum and
maximum length.
is_email() Checks whether the string is a syntactically valid email
address (see the later discussion on the limits of this
function).
contains_bad_words() Checks whether the string contains words defined in
the array $bad_words inside the function.This is helpful
for bulletin boards, discussion rooms, and so forth,
where you want to avoid insulting language.
contains_phone_number() Checks whether a string contains phone numbers—any
10+ digit sequence, optionally separated by parentheses,
spaces, hyphens, or slashes.
Previous  Next  
Link Partners: Asia florist, Flowers to India, Hong kong flowers, Site submit, Cheap web hosting, China florist, Japan florist