Location: PHPKode > projects > The Referral Database > referralsdb/data_valid_fns.php
<?php

function filled_out($form_vars)
{
  // test that each variable has a value
  foreach ($form_vars as $key => $value)
  {
     if (!isset($key) || ($value == "")) 
        return false;
  } 
  return true;
}

function print_required_fields()
{
  echo "The following fields are required: Name, Referral Number, Referral Code, Services Offered, and at least one category must be selected.<p>";
}

function org_required_fields($form_vars)
{
  // test that each variable has a value
  $required = array(Org_Name, Org_Referral_Num, Org_Code, Org_Services_Offered);
  // FIX: also check that at least one category is selected
  foreach ($required as $key) 
  {
   if ($form_vars[$key] == "") 
   {
        print_required_fields();
        return false;
   }
  } 
  return true;
}

function valid_email($address)
{
  // check an email address is possibly valid
  if (ereg("^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$", $address))
    return true;
  else 
    return false;
}

?>
Return current item: The Referral Database