values = $_SESSION['value_array']; $this->errors = $_SESSION['error_array']; $this->num_errors = count($this->errors); $this->user = $_SESSION['username']; } else if(isset($_SESSION['value_array'])){ $this->values = $_SESSION['value_array']; $this->user = $_SESSION['username']; } else{ $this->num_errors = 0; } } /** * setValue - Records the value typed into the given * form field by the user. */ function setValue($field, $value){ $this->values[$field] = $value; } /** * setError - Records new form error given the form * field name and the error message attached to it. */ function setError($field, $errmsg){ $this->errors[$field] = $errmsg; $this->num_errors = count($this->errors); } /** * value - Returns the value attached to the given * field, if none exists, the empty string is returned. */ function value($field){ if(array_key_exists($field,$this->values)){ return htmlspecialchars(stripslashes($this->values[$field])); }else{ return ""; } } /** * error - Returns the error message attached to the * given field, if none exists, the empty string is returned. */ function error($field){ if(array_key_exists($field,$this->errors)){ return "".$this->errors[$field].""; }else{ return ""; } } /* getErrorArray - Returns the array of error messages */ function getErrorArray(){ return $this->errors; } /** * createTextBox - Returns a text box with the specified * parameters * * @param id the id & name for the textbox * @param value the value of the textbox * @param size default 20 * @param maxsize default 50 * @return String the html version of the textbox */ function createTextBox($name, $id, $value, $size, $maxsize, $type = "VARCHAR"){ return ""; } /** * createInputFile - Returns a input file box with the specified parameters * * @param id the id & name for the textbox * @param value the value of the textbox * @return String the html version of the textbox */ function createInputFile($name, $id, $value, $type = "VARCHAR"){ return ""; } /** * createTextArea - Returns a textarea box with the specified parameters * * @param id the id & name for the textbox * @param value the value of the textbox default NULL * @param cols default 10 * @param rows default 10 * @return String the html version of the textbox */ function createTextArea($name, $id, $value = NULL, $cols = 10, $rows = 10, $script = NULL){ return ""; } /** * createPasswordBox - Returns a password box with the specified parameters * * @param id the id & name for the textbox * @param value the value of the textbox * @param size default 20 * @param maxsize default 50 * @return String the html version of the textbox */ function createPasswordBox($name, $id, $value, $size=20, $maxsize=50){ return ""; } /** * createHidden - Returns a hidden box with the specified parameters * * @param id - the id & name for the textbox * @param value - the value of the textbox * @return - the html version of the hidden input box */ function createHidden($id, $value){ return ""; } /** * createRadioButton - Returns a radio button with the specified parameters * * @param nameId - the id & name for the radio * @param value - the value of the radio button * @param checked - the value of the radio button * @param onchangeform - (optional) onchange command * @param formname - (optional) the formname for the onchange command * @return - the html version of the radio button */ function createRadioButton($nameId, $id, $checkedValue, $type = "VARCHAR", $size = null){ foreach($nameId as $name=>$value) { $c = ($checkedValue == $value) ? "checked='checked'" : ""; $radio .= ""; } return $radio; } /** * createCheckBox - Returns a checkbox with the specified parameters * * @param id - the id & name for the checkbox * @param value - the value of the checkbox * @param checked - true or false * @return - the html version of the checkbox */ function createCheckBox($name, $id, $value, $checked, $type = "VARCHAR", $size = null){ foreach($nameId as $name=>$value) { $c = (in_array($value,$checkedValue)) ? "checked='checked'" : ""; $check .= ""; } return $check; } /** * createSubmit - Returns a hidden box with the specified parameters * * @param id - the id & name for the submit button & hidden input box * @param value - the value of the submit button & hidden input box * @return - the html version of the hidden input box & the submit button */ function createSubmit($id, $value){ $c .= ""; return $c; } function text($text) { return $text; } function linebreak() { return "

"; } function finalizeForm($content, $email) { return $content; } }; ?>