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

// include function files for this application
require_once("referrals_fns.php"); 
session_start();


// Check to see if the user is logged in
if (check_admin_user())
{ 
   if (org_required_fields($HTTP_POST_VARS)) 
   {
      $a = new Organization();
      $a->setpostvars($HTTP_POST_VARS);
      
      // Insert the organization  
      $insertorg = $a->insertorg();

      if ($insertorg == 1)
      {
         // Redirect browser to show the new organization
         header("Location: http://".$_SERVER['HTTP_HOST']
                .dirname($_SERVER['PHP_SELF'])
                ."/". 
                "show_organization.php?orgid=$a->Org_ID");
      }
         
      elseif ($insertorg == 0)
      {
         echo_db_error();
         do_html_header("Adding an organization");
         echo "Error inserting organization into the database.";
      }
   } 
   else 
   {
      do_html_header("Adding an organization");
      echo "To fix these mistakes and continue,
            click the Back button of your browser.<BR>";
   }
}

// User isn't logged in
else 
{
   do_html_header("Adding an organization");
   echo "You are not authorized to view this page.";
}
do_html_footer();

?>
Return current item: The Referral Database