action is mail\n"; break; case "T": # Action is Test form MakeHTMLtop($HTML,$SystemVariables); $HTML .= "
action is acknowledgment\n"; break; default: echo "
invalid action\n";
} # End of switch ($Action)
exit;
MakeHTMLtop($HTML,$SystemVariables);
print $HTML;
$HTML="";
DisplayArrayVariables($FormVariables, $DisplayedVariables);
foreach($SystemVariables as $Name=>$Value) {
echo "
name=$Name value=$Value\n";
}
echo "
The form used the $Method method\n"; echo "
Form Variables:\n
\n$DisplayedVariables"; MakeHTMLbottom($HTML,$SystemVariables); print $HTML; exit; # ****************************** Subprograms ********************************** # Function DisplayArrayVariables ############################################### function DisplayArrayVariables(&$FormVariables,&$HTMLVariables) { $HTMLVariables = ""; $LongestName = 0; foreach ($FormVariables as $Name=>$Value) { $HTMLVariables .= "
$Variables[title] by $Variables[organization]
$Variables[returnlinktitle]
MakeBottom;
} # End of function MakeHTMLbottom ############################################
# Function MakeHTMLtop ########################################################
function MakeHTMLtop(&$HTML,&$Variables) {
$HTML=<<$Variables[title]
$Variables[organization]
MakeTop;
} # End of function MakeHTMLtop ###############################################
# Function NameAlias ##########################################################
function NameAlias($Value,$AllowAlias="1") {
if (!$AllowAlias) return $Value;
# Replace blanks, dashes, and underscores with nothing.
$TestKey = preg_replace("/( |-|_)/","",$Value);
$TestKey = strtolower($TestKey);
return $TestKey;
} # End of subroutine NameAlias ###############################################
# Function StartUp ############################################################
function StartUp(&$SystemVariables) {
# Define the SystemVariables associative array.
# System variables can contain a default value by including it below. However,
# default variables are averwritten if passed in hidden fields.
$SystemVariables = array(
# The action variable determines the script's role.
# "M" is mail results to recipient
# "T" test form by displaying form, system, and environment variables
# "A" mail results to recipient and acknowledgment to submitter
action=>"M",
allownamealias=>True, # Allow name aliasing
recipient=>"", # Email recipient - only required hidden field
subject=>"Form Submission", # Email subject
# Cosmetic properties
bgcolor=>"WHITE", # Background color
linkcolor=>"BLUE", # Link color
vlinkcolor=>"RED", # Visited link color
textcolor=>"BLACK", # Text Color
alinkcolor=>"GREEN", # Active Link Color
background=>"", # Background graphic
email=>"", realname=>"",
redirect=>"", # Destignation URL if no errors
# Variables for HTML displayed pages
organization=>"America's Town Square",
title=>"Form Submission",
returnlinkurl=>"", # Return link URL
returnlinktitle=>"", # Return link prompt
sort=>"", print_config=>"",
required=>"", env_report=>"",
print_blank_fields=>"", missing_fields_redirect=>"");
} # End of Function StartUp ###################################################
?>