$db_data["pro_addr2"] = trim($pro_addr2);
 } else {
     //$errors[] = "Missing or Invalid data: ";
 }
 if ($pro_addr3) {
     $db_data["pro_addr3"] = format_street($pro_addr3);
 } else {
     $errors[] = "Missing or Invalid data: Street Name";
 }
 if ($pro_area) {
     $db_data["pro_area"] = $pro_area;
 } else {
     $errors[] = "Missing or Invalid data: Area";
 }
 if ($pro_addr5) {
     $db_data["pro_addr5"] = format_street($pro_addr5);
 } else {
     $errors[] = "Missing or Invalid data: City";
 }
 if ($pro_country) {
     $db_data["pro_country"] = trim($pro_country);
 } else {
     //$errors[] = "Missing or Invalid data: Country";
 }
 if (is_valid_uk_postcode($pro_postcode)) {
     $db_data["pro_postcode"] = format_postcode($pro_postcode);
 } else {
     $errors[] = "Missing or Invalid data: Postcode";
 }
 if ($errors) {
     echo error_message($errors);
';
    } elseif ($_POST["action"] == "Insert") {
        if (!$_POST["Branch"]) {
            $errors[] = "Branch is a required field";
        } else {
            $Branch = trim($_POST["Branch"]);
        }
        if (!$_POST["Neg"]) {
            $errors[] = "Negotiator is a required field";
        } else {
            $Neg = trim($_POST["Neg"]);
        }
        if (!$_POST["Address1"]) {
            $errors[] = "Street Name is a required field";
        } else {
            $Address1 = trim(format_street($_POST["Address1"]));
        }
        if (!$_POST["house_number"]) {
            $errors[] = "House Number is a required field";
        } else {
            $house_number = trim($_POST["house_number"]);
        }
        $Price = trim($_POST["Price"]);
        $PriceType = trim($_POST["PriceType"]);
        $Price2 = trim($_POST["Price2"]);
        $PriceType2 = trim($_POST["PriceType2"]);
        $lease_free = $_POST["lease_free"];
        $state_of_trade_id = $_POST["state_of_trade_id"];
        $type_id = $_POST["type_id"];
        $area_id = $_POST["area_id"];
        if (!$_POST["description"]) {
 } else {
     $intPropID = $_GET["propID"];
     $action = "Update";
     $sql = "SELECT * FROM property WHERE property.prop_ID = {$intPropID} LIMIT 1";
     $q = $db->query($sql);
     if (DB::isError($q)) {
         die("property select error: " . $q->getMessage());
     }
     while ($row = $q->fetchRow()) {
         $intPrice = $row["Price"];
         $strPrice = price_format($intPrice);
         $intPriceType = $row["PriceType"];
         $intPrice2 = $row["Price2"];
         $intPriceType2 = $row["PriceType2"];
         $strNumber = $row["house_number"];
         $strStreet = format_street($row["Address1"]);
         $strPostcode = $row["Postcode"];
         $strPC1 = explode(" ", $strPostcode);
         $strPC1 = $strPC1[0];
         $intOSX = $row["osx"];
         $intOSY = $row["osy"];
         $intTenure = $row["lease_free"];
         $intStatus = $row["state_of_trade_id"];
         $intType = $row["type_id"];
         if ($intType == "1" || $intType == "2" || $intType == "5" || $intType == "7") {
             $strLinkType = "House";
         } elseif ($intType == "3" || $intType == "4" || $intType == "6") {
             $strLinkType = "Apartment";
         } elseif ($intType == "8") {
             $strLinkType = "Commercial";
         } elseif ($intType == "9") {
pro_pcid=-1&
pro_addr1=1&
pro_addr2=2&
pro_addr3=3&
pro_addr5=4&
pro_postcode=5&
pro_country=217&
form2=Save+Changes

*/
if ($_GET["pro_pcid"] == '-1') {
    $db_data["pro_pcid"] = '-1';
    $db_data["pro_addr1"] = format_street($_GET["pro_addr1"]);
    $db_data["pro_addr2"] = format_street($_GET["pro_addr2"]);
    $db_data["pro_addr3"] = format_street($_GET["pro_addr3"]);
    $db_data["pro_addr5"] = format_street($_GET["pro_addr5"]);
    $db_data["pro_postcode"] = format_postcode($_GET["pro_postcode"]);
    $db_data["pro_country"] = $_GET["pro_country"];
    $_GET["pro_pro_id"] = db_query($db_data, "INSERT", "property", "pro_id");
}
// if a property id is given, get info from pro table, deal and client tables
if ($_GET["pro_id"]) {
    $sql = "SELECT\n\tdea_id,pro_pcid,\n\tCONCAT('<a href=tools/edit_property.php?pro_id=',pro_id,'>',property.pro_addr1,' ',property.pro_addr2,' ',property.pro_addr3,' ',property.pro_addr4,' ',property.pro_postcode,'</a>') AS Property,\n\tCONCAT('<a href=deal_summary.php?dea_id=',deal.dea_id,'>',property.pro_addr1,' ',property.pro_addr2,'  ',property.pro_addr3,' ',property.pro_postcode,' (',deal.dea_type,' / ',deal.dea_status,')</a>') AS Deal\n\tFROM\n\tproperty\n\tLEFT JOIN deal ON deal.dea_prop\t= property.pro_id\n\tWHERE\n\tpro_id = " . $_GET["pro_id"];
    if ($_GET["dea_id"]) {
        $sql .= " AND deal.dea_id = " . $_GET["dea_id"];
    }
    $q = $db->query($sql);
    if (DB::isError($q)) {
        die("db error: " . $q->getMessage());
    }
    //$prop = "<pre>";