Location: PHPKode > projects > Homeless Mangement Information System > hmis/include/question_set_validation_function.inc
<?php
//*Client Data System, Copyright (C) 2000, 2001 Tedd Kelleher.  This is free software, subject to the 
//*GNU GENERAL PUBLIC LICENSE, Version 2, June 1991 (in file named gpl.txt), which should accompany 
//*any distribution of this file.  Tedd Kelleher can be contacted at hide@address.com


function question_set_validation($report_questions_set, $a)	{

	// $a is the vetted form answer

	$sql = "SELECT * FROM validation_php WHERE validation_question_set LIKE '".$report_questions_set."'";
	$result = run_query($sql, "Pulling the question set validation");

	$count_of_tests = num_rows($result);

	if($count_of_tests > 0)	{
		
		for($x = 0; $x < $count_of_tests; $x++)	{
			$test_array = fetch_array($result, "Pulling questions set test array", $x);
			$test_string = "if(".$test_array["validation_logic"]."){\$error = \"yes\";} else {\$error = \"no\";}";
			eval ( $test_string );

			//If there is an error as defined by the logic pulled from the DB above, perform the actions in "validation_actions."
			if($error == "yes")	{
				$sql_messages = "SELECT * FROM validation_actions WHERE validation_id = '".$test_array["validation_id"]."'";
				$result_messages = run_query($sql_messages, "Pulling the question set validation");

				$message_count = num_rows($result_messages);

				if($message_count > 0)	{
					for($y = 0; $y < $message_count; $y++)	{
					
					$message_array = fetch_array($result_messages, "Pulling question set message error array", $y);
					
                    //Function contained in "questions_display_functions.inc"
					dynamic_field_marking ($message_array["action_target_id"], $message_array["message_target"], $message_array["message_head"], $message_array["message_type"], $a);

															}
										}


								}


												}

							}
															}

															

?>
Return current item: Homeless Mangement Information System