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

// include function files for this application
require_once("referrals_fns.php"); 
session_start();
header("Cache-control: private");

do_html_header("Deleting organization");

$orgid = $_POST['Org_ID'];
if (check_admin_user())
{
   if ($orgid) 
   {
      $c = new Organization();
      $c->setOrg_ID($orgid);

      // Make sure the organization exists
      $orgexists = organization_exists($orgid);

      if ($orgexists == 2)
      {
         echo "Failure deleting organization, it does not exist.<P>";
      }

      else
      {
         // Get the organization name from the database
         $c->getOrg_Name();
         
         // Delete the organization, store result in $deletestatus
         $deletestatus = $c->deleteorg();

         if ($deletestatus == 1)
         {
            // Successful delete
            echo "Organization '$c->Org_Name' was deleted.<br>";
         }

         else
         {
            echo "Organization '$c->Org_Name' could not be updated.<br>";
         }
      }
   } 

   else
   {
      echo "No organization ID was specified.
            Please try again.<br>";
   }
}
   
else 
{
   echo "You are not authorized to view this page."; 
}

do_html_footer();

?>
Return current item: The Referral Database