<?php
if (isset($_POST['formaction']) && ($_POST['formaction'] == 'add' || $_POST['formaction'] == 'edit'))
{
	$FULLNAME			= trim($funcObj->AppendSlashes($_POST['txtname']));
	$EMAIL 				= trim($funcObj->AppendSlashes($_POST['txtemail']));
	$USER_TYPE 			= trim($funcObj->AppendSlashes($_POST['selusertype']));
	$PASSWORD 			= trim($funcObj->AppendSlashes($_POST['txtpassword']));
	$CONFIRMPASSWORD 	= trim($funcObj->AppendSlashes($_POST['txtconfirmpassword']));
	$ID 				= $_POST['ID'];
	$IS_ACTIVE			= $_POST['chkIsActive'];
	
	$error = "";
	
	if (empty($FULLNAME))
	{
		$error .= "Name is required.<br />";
	}
	
	if (empty($EMAIL))
	{
		$error .= "E-mail address is required.<br /> ";
	}
	else if (!validate_email ($EMAIL))
	{
		$error 	= "Invalid e-mail address.<br />";
	}
	if (($_POST['formaction'] == 'add') || (!empty($PASSWORD)))
	{
		if (empty($PASSWORD))
		{
			$error .= "Password cannot be left blank.<br /> ";
		}
		else if ($PASSWORD != $CONFIRMPASSWORD)
		{
			$error .= "Password mismatch.<br /> ";
		}
	}
	if (strlen($error))
	{
		$errorMsg = "<strong>Please correct the following error(s):</strong> <br />
		$error";
	}
}
?>