Breaking

Followers

Showing posts with label JQUERY. Show all posts
Showing posts with label JQUERY. Show all posts

Tuesday, 16 January 2018

1/16/2018 01:47:00 am

3 Character Country Codes Using Google Maps Api

Is there a way I can get the 3 char country code in Google maps’s Reverse Geocoding?
The below query returns the 2 char country code (ISO 3166-1 encoding). But I need to have the 3 char country code.

HTML:


<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<script src="https://maps.googleapis.com/maps/api/js?libraries=places"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500">
</head>

<body>

<div id="locationField">
  <input id="autocomplete" placeholder="Enter your address" type="text" />
</div>
<table id="address">
  <tr>
    <td class="label">City</td>
    <td class="wideField" colspan="3">
      <input class="field" id="locality" disabled="true" />
    </td>
  </tr>
  <tr>
    <td class="label">State</td>
    <td class="slimField">
      <input class="field" id="administrative_area_level_1" disabled="true" />
    </td>
  </tr>
  <tr>
    <td class="label">Country</td>
    <td class="wideField" colspan="2">
      <input class="field" id="country" disabled="true" />
    </td>
    <td class="label">Country Code</td>
    <td class="shortField">
      <input class="field" id="country_code" disabled="true" />
    </td>
  </tr>
  <tr>
    <td class="label">latitude</td>
    <td class="wideField" colspan="3">
      <input class="field" id="lat" disabled="true" />
    </td>
  </tr>
  <tr>
    <td class="label">longitude</td>
    <td class="wideField" colspan="3">
      <input class="field" id="lng" disabled="true" />
    </td>
  </tr>
</table>


</body>
</html>


Javascript:

  // This example displays an address form, using the autocomplete feature
// of the Google Places API to help users fill in the information.

function fillInAddress() {
  // country code array with two letter and thre letter.
  var countries = [
    {"two" :"AF","three" : "AFG" },
    {"two" :"AL","three" : "ALB" },
    {"two" :"DZ","three" : "DZA" },
    {"two" :"AS","three" : "ASM" },
    {"two" :"AD","three" : "AND" },
    {"two" :"AO","three" : "AGO" },
    {"two" :"AI","three" : "AIA" },
    {"two" :"AQ","three" : "ATA" },
    {"two" :"AG","three" : "ATG" },
    {"two" :"AR","three" : "ARG" },
    {"two" :"AM","three" : "ARM" },
    {"two" :"AW","three" : "ABW" },
    {"two" :"AU","three" : "AUS" },
    {"two" :"AT","three" : "AUT" },
    {"two" :"AZ","three" : "AZE" },
    {"two" :"BS","three" : "BHS" },
    {"two" :"BH","three" : "BHR" },
    {"two" :"BD","three" : "BGD" },
    {"two" :"BB","three" : "BRB" },
    {"two" :"BY","three" : "BLR" },
    {"two" :"BE","three" : "BEL" },
    {"two" :"BZ","three" : "BLZ" },
    {"two" :"BJ","three" : "BEN" },
    {"two" :"BM","three" : "BMU" },
    {"two" :"BT","three" : "BTN" },
    {"two" :"BO","three" : "BOL" },
    {"two" :"BO","three" : "BOL" },
    {"two" :"BA","three" : "BIH" },
    {"two" :"BW","three" : "BWA" },
    {"two" :"BV","three" : "BVT" },
    {"two" :"BR","three" : "BRA" },
    {"two" :"IO","three" : "IOT" },
    {"two" :"BN","three" : "BRN" },
    {"two" :"BN","three" : "BRN" },
    {"two" :"BG","three" : "BGR" },
    {"two" :"BF","three" : "BFA" },
    {"two" :"BI","three" : "BDI" },
    {"two" :"KH","three" : "KHM" },
    {"two" :"CM","three" : "CMR" },
    {"two" :"CA","three" : "CAN" },
    {"two" :"CV","three" : "CPV" },
    {"two" :"KY","three" : "CYM" },
    {"two" :"CF","three" : "CAF" },
    {"two" :"TD","three" : "TCD" },
    {"two" :"CL","three" : "CHL" },
    {"two" :"CN","three" : "CHN" },
    {"two" :"CX","three" : "CXR" },
    {"two" :"CC","three" : "CCK" },
    {"two" :"CO","three" : "COL" },
    {"two" :"KM","three" : "COM" },
    {"two" :"CG","three" : "COG" },
    {"two" :"CD","three" : "COD" },
    {"two" :"CK","three" : "COK" },
    {"two" :"CR","three" : "CRI" },
    {"two" :"CI","three" : "CIV" },
    {"two" :"CI","three" : "CIV" },
    {"two" :"HR","three" : "HRV" },
    {"two" :"CU","three" : "CUB" },
    {"two" :"CY","three" : "CYP" },
    {"two" :"CZ","three" : "CZE" },
    {"two" :"DK","three" : "DNK" },
    {"two" :"DJ","three" : "DJI" },
    {"two" :"DM","three" : "DMA" },
    {"two" :"DO","three" : "DOM" },
    {"two" :"EC","three" : "ECU" },
    {"two" :"EG","three" : "EGY" },
    {"two" :"SV","three" : "SLV" },
    {"two" :"GQ","three" : "GNQ" },
    {"two" :"ER","three" : "ERI" },
    {"two" :"EE","three" : "EST" },
    {"two" :"ET","three" : "ETH" },
    {"two" :"FK","three" : "FLK" },
    {"two" :"FO","three" : "FRO" },
    {"two" :"FJ","three" : "FJI" },
    {"two" :"FI","three" : "FIN" },
    {"two" :"FR","three" : "FRA" },
    {"two" :"GF","three" : "GUF" },
    {"two" :"PF","three" : "PYF" },
    {"two" :"TF","three" : "ATF" },
    {"two" :"GA","three" : "GAB" },
    {"two" :"GM","three" : "GMB" },
    {"two" :"GE","three" : "GEO" },
    {"two" :"DE","three" : "DEU" },
    {"two" :"GH","three" : "GHA" },
    {"two" :"GI","three" : "GIB" },
    {"two" :"GR","three" : "GRC" },
    {"two" :"GL","three" : "GRL" },
    {"two" :"GD","three" : "GRD" },
    {"two" :"GP","three" : "GLP" },
    {"two" :"GU","three" : "GUM" },
    {"two" :"GT","three" : "GTM" },
    {"two" :"GG","three" : "GGY" },
    {"two" :"GN","three" : "GIN" },
    {"two" :"GW","three" : "GNB" },
    {"two" :"GY","three" : "GUY" },
    {"two" :"HT","three" : "HTI" },
    {"two" :"HM","three" : "HMD" },
    {"two" :"VA","three" : "VAT" },
    {"two" :"HN","three" : "HND" },
    {"two" :"HK","three" : "HKG" },
    {"two" :"HU","three" : "HUN" },
    {"two" :"IS","three" : "ISL" },
    {"two" :"IN","three" : "IND" },
    {"two" :"ID","three" : "IDN" },
    {"two" :"IR","three" : "IRN" },
    {"two" :"IQ","three" : "IRQ" },
    {"two" :"IE","three" : "IRL" },
    {"two" :"IM","three" : "IMN" },
    {"two" :"IL","three" : "ISR" },
    {"two" :"IT","three" : "ITA" },
    {"two" :"JM","three" : "JAM" },
    {"two" :"JP","three" : "JPN" },
    {"two" :"JE","three" : "JEY" },
    {"two" :"JO","three" : "JOR" },
    {"two" :"KZ","three" : "KAZ" },
    {"two" :"KE","three" : "KEN" },
    {"two" :"KI","three" : "KIR" },
    {"two" :"KP","three" : "PRK" },
    {"two" :"KR","three" : "KOR" },
    {"two" :"KR","three" : "KOR" },
    {"two" :"KW","three" : "KWT" },
    {"two" :"KG","three" : "KGZ" },
    {"two" :"LA","three" : "LAO" },
    {"two" :"LV","three" : "LVA" },
    {"two" :"LB","three" : "LBN" },
    {"two" :"LS","three" : "LSO" },
    {"two" :"LR","three" : "LBR" },
    {"two" :"LY","three" : "LBY" },
    {"two" :"LY","three" : "LBY" },
    {"two" :"LI","three" : "LIE" },
    {"two" :"LT","three" : "LTU" },
    {"two" :"LU","three" : "LUX" },
    {"two" :"MO","three" : "MAC" },
    {"two" :"MK","three" : "MKD" },
    {"two" :"MG","three" : "MDG" },
    {"two" :"MW","three" : "MWI" },
    {"two" :"MY","three" : "MYS" },
    {"two" :"MV","three" : "MDV" },
    {"two" :"ML","three" : "MLI" },
    {"two" :"MT","three" : "MLT" },
    {"two" :"MH","three" : "MHL" },
    {"two" :"MQ","three" : "MTQ" },
    {"two" :"MR","three" : "MRT" },
    {"two" :"MU","three" : "MUS" },
    {"two" :"YT","three" : "MYT" },
    {"two" :"MX","three" : "MEX" },
    {"two" :"FM","three" : "FSM" },
    {"two" :"MD","three" : "MDA" },
    {"two" :"MC","three" : "MCO" },
    {"two" :"MN","three" : "MNG" },
    {"two" :"ME","three" : "MNE" },
    {"two" :"MS","three" : "MSR" },
    {"two" :"MA","three" : "MAR" },
    {"two" :"MZ","three" : "MOZ" },
    {"two" :"MM","three" : "MMR" },
    {"two" :"MM","three" : "MMR" },
    {"two" :"NA","three" : "NAM" },
    {"two" :"NR","three" : "NRU" },
    {"two" :"NP","three" : "NPL" },
    {"two" :"NL","three" : "NLD" },
    {"two" :"AN","three" : "ANT" },
    {"two" :"NC","three" : "NCL" },
    {"two" :"NZ","three" : "NZL" },
    {"two" :"NI","three" : "NIC" },
    {"two" :"NE","three" : "NER" },
    {"two" :"NG","three" : "NGA" },
    {"two" :"NU","three" : "NIU" },
    {"two" :"NF","three" : "NFK" },
    {"two" :"MP","three" : "MNP" },
    {"two" :"NO","three" : "NOR" },
    {"two" :"OM","three" : "OMN" },
    {"two" :"PK","three" : "PAK" },
    {"two" :"PW","three" : "PLW" },
    {"two" :"PS","three" : "PSE" },
    {"two" :"PA","three" : "PAN" },
    {"two" :"PG","three" : "PNG" },
    {"two" :"PY","three" : "PRY" },
    {"two" :"PE","three" : "PER" },
    {"two" :"PH","three" : "PHL" },
    {"two" :"PN","three" : "PCN" },
    {"two" :"PL","three" : "POL" },
    {"two" :"PT","three" : "PRT" },
    {"two" :"PR","three" : "PRI" },
    {"two" :"QA","three" : "QAT" },
    {"two" :"RE","three" : "REU" },
    {"two" :"RO","three" : "ROU" },
    {"two" :"RU","three" : "RUS" },
    {"two" :"RU","three" : "RUS" },
    {"two" :"RW","three" : "RWA" },
    {"two" :"SH","three" : "SHN" },
    {"two" :"KN","three" : "KNA" },
    {"two" :"LC","three" : "LCA" },
    {"two" :"PM","three" : "SPM" },
    {"two" :"VC","three" : "VCT" },
    {"two" :"VC","three" : "VCT" },
    {"two" :"VC","three" : "VCT" },
    {"two" :"WS","three" : "WSM" },
    {"two" :"SM","three" : "SMR" },
    {"two" :"ST","three" : "STP" },
    {"two" :"SA","three" : "SAU" },
    {"two" :"SN","three" : "SEN" },
    {"two" :"RS","three" : "SRB" },
    {"two" :"SC","three" : "SYC" },
    {"two" :"SL","three" : "SLE" },
    {"two" :"SG","three" : "SGP" },
    {"two" :"SK","three" : "SVK" },
    {"two" :"SI","three" : "SVN" },
    {"two" :"SB","three" : "SLB" },
    {"two" :"SO","three" : "SOM" },
    {"two" :"ZA","three" : "ZAF" },
    {"two" :"GS","three" : "SGS" },
    {"two" :"ES","three" : "ESP" },
    {"two" :"LK","three" : "LKA" },
    {"two" :"SD","three" : "SDN" },
    {"two" :"SR","three" : "SUR" },
    {"two" :"SJ","three" : "SJM" },
    {"two" :"SZ","three" : "SWZ" },
    {"two" :"SE","three" : "SWE" },
    {"two" :"CH","three" : "CHE" },
    {"two" :"SY","three" : "SYR" },
    {"two" :"TW","three" : "TWN" },
    {"two" :"TW","three" : "TWN" },
    {"two" :"TJ","three" : "TJK" },
    {"two" :"TZ","three" : "TZA" },
    {"two" :"TH","three" : "THA" },
    {"two" :"TL","three" : "TLS" },
    {"two" :"TG","three" : "TGO" },
    {"two" :"TK","three" : "TKL" },
    {"two" :"TO","three" : "TON" },
    {"two" :"TT","three" : "TTO" },
    {"two" :"TT","three" : "TTO" },
    {"two" :"TN","three" : "TUN" },
    {"two" :"TR","three" : "TUR" },
    {"two" :"TM","three" : "TKM" },
    {"two" :"TC","three" : "TCA" },
    {"two" :"TV","three" : "TUV" },
    {"two" :"UG","three" : "UGA" },
    {"two" :"UA","three" : "UKR" },
    {"two" :"AE","three" : "ARE" },
    {"two" :"GB","three" : "GBR" },
    {"two" :"US","three" : "USA" },
    {"two" :"UM","three" : "UMI" },
    {"two" :"UY","three" : "URY" },
    {"two" :"UZ","three" : "UZB" },
    {"two" :"VU","three" : "VUT" },
    {"two" :"VE","three" : "VEN" },
    {"two" :"VE","three" : "VEN" },
    {"two" :"VN","three" : "VNM" },
    {"two" :"VN","three" : "VNM" },
    {"two" :"VG","three" : "VGB" },
    {"two" :"VI","three" : "VIR" },
    {"two" :"WF","three" : "WLF" },
    {"two" :"EH","three" : "ESH" },
    {"two" :"YE","three" : "YEM" },
    {"two" :"ZM","three" : "ZMB" },
    {"two" :"ZW","three" : "ZWE" }
    ];//etc
  
  // Get the place details from the autocomplete object.
  var place = autocomplete.getPlace();

  for (var component in componentForm) {
    document.getElementById(component).value = '';
  }

  // Get each component of the address from the place details
  // and fill the corresponding field on the form.
  for (var i = 0; i < place.address_components.length; i++) {
    var addressType = place.address_components[i].types[0];
    if (componentForm[addressType]) {
      var val = place.address_components[i][componentForm[addressType]];
      document.getElementById(addressType).value = val;
    }
    // for the country, get the country code (the "short name") also
    if (addressType == "country") {
      console.log(getKeyByParameter(countries, place.address_components[i].short_name));
      document.getElementById("country_code").value = getKeyByParameter(countries, place.address_components[i].short_name);
    }
  }
}

var placeSearch, autocomplete;
var componentForm = {
  locality: 'long_name',
  administrative_area_level_1: 'short_name',
  country: 'long_name',
};

function initAutocomplete() {
  // Create the autocomplete object, restricting the search to geographical
  // location types.
  autocomplete = new google.maps.places.Autocomplete(
    /** @type {!HTMLInputElement}     */
    (document.getElementById('autocomplete')), {
      types: ['(cities)']
    });

  // When the user selects an address from the dropdown, populate the address
  // fields in the form.
  // Get Latitude and longitude
  google.maps.event.addListener(autocomplete, 'place_changed', function() {
    var place = autocomplete.getPlace();
    console.log(place);
    document.getElementById('lat').value = place.geometry.location.lat();
    document.getElementById('lng').value = place.geometry.location.lng();
    fillInAddress();
  });
}
google.maps.event.addDomListener(window, 'load', initAutocomplete);



// function for revers coding 
var getKeyByParameter = function(obj, parameter) {
var returnVal = "";

jQuery.each(obj, function(key, info) {
    if (info.two == parameter) {
       returnVal = info.three;
        return false; 
    };   
});

return returnVal;       

}



Sunday, 28 May 2017

5/28/2017 10:32:00 pm

Set images as background in loop

Features:- Set Images as a background in parent div.

HTML:

<ul>
  <li class="bg0"> <img src="images/homebanner1.jpg" width="1349" height="700" alt=""> </li>
  <li class="bg1"> <img src="images/homebanner2.jpg" width="1349" height="700" alt=""> </li>
  <li class="bg2"> <img src="images/homebanner3.jpg" width="1349" height="700" alt=""> </li>
  <li class="bg3"> <img src="images/homebanner4.jpg" width="1349" height="700" alt=""> </li>
</ul>

jQuery:
$("ul li img").each(function(a){var b=$(this).attr("src");$("ul li.bg"+a).css("background-image","url("+b+")")});

Wednesday, 22 April 2015

4/22/2015 05:13:00 am

Website Design and Development Package

Web Application Freelancer offers Top class interactive website development & design services to give your business a significant help and boost  you forge ahead in a highly competitive in the market. Our expert developers & designers use open source as well as closed source technologies to create  responsive, interactive websites, feature rich that become a platform for interaction with customers, buyers and between staff, helping you boost efficiency's and increase productivity(Sales) as well as enhance your image.
Web Application Freelancers  top  feature rich interactive websites for :
  •          E-commerce
  •          Online Educational websites
  •          Banking And  Finance
  •          Database based websites
  •          CMS Websites
  •          Portals

Our teams of expert, experienced, skilled and knowledgeable developer use current technologies such as:

  • PHP5, MySQL
  • Ajax,
  • JavaScript, JQuery
  • HTML5, CSS3
  • Bootstrap
  • Drupal, WordPress,  Joomla,  Magento
For server side/client side scripting to create. Developers integrate coding into front end designs created by talented team of designers for unified,  logical, harmonious, intuitive interface.
  • You benefit from our qualified, trained and experienced manpower, in-house as well as on contract
  • .You receive professional, knowledgeable and thorough services.
  • We have the infrastructure, communication base, support structures.
  • You receive prompt and punctual services, 24x7 support before, during and after completion of the project.
  • We are friendly, geared to assist you prosper and grow in your business and achieve greater success in a competitive environment through your interactive websites designed and developed by us, offering best ROIs.
How we work
  • A preliminary project is prepared and submitted to you for approval and terms are agreed upon;
  • Web Application Freelancer experts discuss your requirements, understand what you expect and explain what can be achieved;
  • Simultaneously, our market researchers study competition, current markets, potential customer expectation and behaviors and the analysed data is considered while developing your website;
  • For IT companies to whom we provide offshore, outsourced professional interactive website services at affordable rates, either on project basis, hourly basis or monthly basis. We also provide contracted programmers for in-house or offshore interactive website development.
  • Our programmers begin working on your interactive web, keeping you constantly updated. We follow the agile path to development with modifications and refinements being incorporated as we go along instead of at the final stage;
  • The final interactive website is tested for bugs and errors on in-house server before being hosted and again after hosting with small kinks ironed out in the process. Rigorous tests for accessibility, errors and functionality are carried out on different browsers and platforms.
  • Your personnel receive training, if and where needed. Our dynamic, agile, interactive website development services are available for:
  • Small, medium and large enterprises in India and across the world;
  • For institutions, NGOs, governments;

 



Sunday, 29 March 2015

3/29/2015 11:04:00 pm

how to add dynamically multiple row with jquery and mysql in php?

I wrote about adding dynamic input fields in a webpage using  html ,jQuery, php and mysql, I got multiple of queries on how to submit it to database. This is all about generating input fields on the fly in a web page and submitting the entered data into database.  You can use this blog post to build more user friendly forms
which collect data from users. users can create fields on the fly and enter data.











<html>
<head>

<title>Untitled Document</title>
<script language="JavaScript" type="text/javascript">
  //You should create the validator only after the definition of the HTML form
  var frmvalidator  = new Validator("form1");

  frmvalidator.addValidation("eng_name","req","Please Enter Sub Page Name");
  frmvalidator.addValidation("custom_url","req","Please enter URL");

  function addRow(tableID) {
 
  var table = document.getElementById(tableID);

  var rowCount = table.rows.length;
  if(rowCount < 20){       // limit the user from creating fields more than your limits
   var row = table.insertRow(rowCount);
   var colCount = table.rows[0].cells.length;
   for(var i=0; i<colCount; i++) {
    var newcell = row.insertCell(i);
   
    newcell.innerHTML = table.rows[0].cells[i].innerHTML;

   
     $('#dataTable tr:last .checkb:last').attr('id',rowCount);
     $('#dataTable tr:last .bed:last').attr('id','bed_'+rowCount);
     $('#dataTable tr:last .bathrooms:last').attr('id','bathrooms_'+rowCount);
     $('#dataTable tr:last .txtUnitName:last').attr('id','txtUnitName_'+rowCount);
   
     $('#dataTable tr:last .txtSize:last').attr('id','txtSize_'+rowCount);
     $('#dataTable tr:last .txtppua:last').attr('id','txtppua_'+rowCount);
     $('#dataTable tr:last .BX_tc:last').attr('id','BX_tc_'+rowCount);
   

     $('#dataTable tr:last .reset:last').val("");
   
 
 
   }
  }else{
 
     
  }
}

$("#txtppua").blur(function(){
        alert("This input field has lost its focus.");
    });
function deleteRow(tableID) {
 var table = document.getElementById(tableID);
 var rowCount = table.rows.length;
 for(var i=0; i<rowCount; i++) {
  var row = table.rows[i];
  var chkbox = row.cells[0].childNodes[0];
  if(null != chkbox && true == chkbox.checked) {
   if(rowCount <= 1) {       // limit the user from removing all the fields
    //alert("Cannot Remove all the Passenger.");
    break;
   }
   table.deleteRow(i);
   rowCount--;
   i--;
  }
 }
}


 </script>
<script language="Javascript">

      function isNumberKey(evt)
      {


         var charCode = (evt.which) ? evt.which : event.keyCode;
   if(charCode == 99 || charCode == 118)
          return true;
         if (charCode > 31 && (charCode < 46 || charCode > 57))
            return false;

         return true;
      }



  function fillUnitName(id)
  {
 
  var idValues=id;


  var arr = idValues.split('_');
  var idValue=arr[1];
  var selectValBed = $("#bed_"+idValue+" :selected").val();

  var selectValBath = $("#bathrooms_"+idValue+" :selected").val();
  var carpet_id = "txtCarpetAreaInfo_"+(idValue);
  if(selectValBed!='0' && selectValBath!='0')
  {
   var str=selectValBed+"BHK+"+selectValBath+"T";
   if($("#"+carpet_id).attr('checked'))
    var unitName=$("#txtUnitName_"+idValue).val(str+"(Carpet)");
   else
    var unitName=$("#txtUnitName_"+idValue).val(str);
  }
  }

  function TotalCost(id)
  {
 
  var idValues=id;
  var arr = idValues.split('_');
  var idValue=arr[1];
  //alert(idValues);


  var PricePerUnit=$("#txtppua_"+idValue).val();
  var txtSize=$("#txtSize_"+idValue).val();
  var total_pr=PricePerUnit*txtSize;
  $("#BX_tc_"+idValue).val(total_pr);


  }
  function show_add(id)
  {

  var idValues=id;


  var arr = idValues.split('_');
  var idValue=arr[1];

  var id = "add_"+(id+1);
  var unitName=$("#txtUnitName_"+idValue).val();
  var txtPricePerUnitArea=$("#txtPricePerUnitArea_"+idValue).val();
  var txtSize=$("#txtSize_"+idValue).val();
  var selectVal = $("#bed_"+idValue+" :selected").val();
  if(unitName !='' && txtSize!='' && selectVal!='0')
  {
   document.getElementById(id).style.display = '';
  }
  else
  {
   document.getElementById(id).style.display = 'none';
  }

  }
/*******function for deletion confirmation***********/
    function chkConfirm()
    {
        var chk = 0;
        for(var i=0;i<=30;i++) {    
            if($("#"+i).attr('checked')) {
                chk = 1;
            }
        }

        if(chk == 1)
            return confirm("Are you sure! you want to delete records which are checked.");
    }
    function add_carpet(index){

  carpet_id = "txtCarpetAreaInfo_"+(index + 1);
  unitname_id = "txtUnitName_"+(index + 1);
  unitname_val = $("#"+unitname_id).val();

  if($("#"+carpet_id).attr('checked')){
   $("#"+unitname_id).val(unitname_val+"(Carpet)");
  }else{
   unitname_val = unitname_val.replace("(Carpet)","")
   $("#"+unitname_id).val(unitname_val);
  }

 

 }

</script>
</head>

<body>

  <input onclick="addRow('dataTable')" type="button" value="Add Configuration" />

  &lt;!--    <input onclick="deleteRow('dataTable')" type="button" value="Remove Configuration" /></body></html>
<table 983px="" border="&quot;1&quot;" class="&quot;form&quot;" id="&quot;rounded-corner&quot;" important="" quot="">
  <thead>
<tr>
      <th class="&quot;rounded-company&quot;">Del</th>
      <th bbd="" class="&quot;rounded" quot="" scope="&quot;col&quot;" valign="&quot;&quot;" width="&quot;&quot;">Bedrooms</th>
      <th bbd="" class="&quot;rounded" quot="" scope="&quot;col&quot;" valign="&quot;&quot;" width="&quot;&quot;">Bathrooms</th>
      <th bbd="" class="&quot;rounded" quot="" scope="&quot;col&quot;" valign="&quot;&quot;" width="&quot;&quot;">Unit Name</th>
      <th bbdc="" class="&quot;rounded" quot="" scope="&quot;col&quot;" valign="&quot;&quot;" width="&quot;&quot;">Size</th>
      <th bbdc="" class="&quot;rounded" quot="" scope="&quot;col&quot;" valign="&quot;&quot;" width="&quot;&quot;">Price Per Unit Area</th>
      <th bbd="" class="&quot;rounded" quot="" scope="&quot;col&quot;" valign="&quot;&quot;" width="&quot;&quot;">Balcony</th>
      <th bbd="" class="&quot;rounded" quot="" scope="&quot;col&quot;" valign="&quot;&quot;" width="&quot;&quot;">Servant Room</th>
      <th bbd="" class="&quot;rounded" quot="" scope="&quot;col&quot;" valign="&quot;&quot;" width="&quot;&quot;">Pooja Room</th>
      <th bbd="" class="&quot;rounded" quot="" scope="&quot;col&quot;" valign="&quot;&quot;" width="&quot;&quot;">Study Room</th>
      <th bbdc="" class="&quot;rounded" quot="" scope="&quot;col&quot;" valign="&quot;&quot;" width="&quot;&quot;">Total Cost</th>
      <th bbdcd="" class="&quot;rounded-q4" quot="">Floor Plan</th>
    </tr>
</thead>
</table>
<table border="&quot;1&quot;" class="&quot;form&quot;" id="&quot;dataTable&quot;">
  <tbody>
<tr>
   
      <td align="&quot;&quot;" valign="&quot;middle&quot;" width="&quot;500&quot;"><a 6px="" class="&quot;ask&quot;" href="https://www.blogger.com/%22configuration_pages_manage.php?property_id=11&amp;del_id=365%22" quot=""><img border="&quot;0&quot;" src="&quot;OBERNDEV.COM/images/trash.png&quot;" /></a>
        <input class="&quot;checkb" id="&quot;1&quot;" name="&quot;chk[]&quot;" none="" quot="" reset="" type="&quot;checkbox&quot;" />
        <input class="&quot;checkb" name="&quot;c_id[]&quot;" quot="" reset="" type="&quot;hidden&quot;" value="&quot;365&quot;" /></td>
      <td align="&quot;&quot;" valign="&quot;middle&quot;" width="&quot;500&quot;"><select 67px="" class="&quot;bed" fillunitname="" id="&quot;bed_0&quot;" name="&quot;BX_Bedrooms[]&quot;" onchange="&quot;show_add(this.id);" quot="" reset="" tempname="&quot;bed&quot;" this.id="">
          <option value="&quot;0&quot;">Select</option>
          <option value="&quot;1&quot;">1</option>
          <option value="&quot;2&quot;">2</option>
          <option value="&quot;3&quot;">3</option>
          <option selected="&quot;selected&quot;" value="&quot;4&quot;">4</option>
          <option value="&quot;5&quot;">5</option>
          <option value="&quot;6&quot;">6</option>
          <option value="&quot;7&quot;">7</option>
          <option value="&quot;8&quot;">8</option>
          <option value="&quot;9&quot;">9</option>
          <option value="&quot;10&quot;">10</option>
        </select></td>
      <td align="&quot;&quot;" valign="&quot;middle&quot;" width="&quot;500&quot;"><select 71px="" class="&quot;bathrooms" id="&quot;bathrooms_0&quot;" name="&quot;BX_Bathrooms[]&quot;" onchange="&quot;fillUnitName(this.id);&quot;" quot="" reset="" tempname="&quot;bathrooms&quot;">
          <option value="&quot;0&quot;">Select</option>
          <option value="&quot;1&quot;">1</option>
          <option value="&quot;2&quot;">2</option>
          <option value="&quot;3&quot;">3</option>
          <option selected="&quot;selected&quot;" value="&quot;4&quot;">4</option>
          <option value="&quot;5&quot;">5</option>
          <option value="&quot;6&quot;">6</option>
          <option value="&quot;7&quot;">7</option>
          <option value="&quot;8&quot;">8</option>
          <option value="&quot;9&quot;">9</option>
          <option value="&quot;10&quot;">10</option>
        </select></td>
      <td align="&quot;&quot;" valign="&quot;middle&quot;" width="&quot;500&quot;"><input 57px="" class="&quot;small" id="&quot;txtUnitName_0&quot;" name="&quot;BX_Unit_Name[]&quot;" onblur="&quot;show_add(this.id);&quot;" quot="" required="&quot;required&quot;" reset="" txtunitname="" type="&quot;text&quot;" value="&quot;3BHK+4T&quot;" /></td>
      <td align="&quot;&quot;" valign="&quot;middle&quot;" width="&quot;500&quot;"><input 55px="" class="&quot;small" event="" id="&quot;txtSize_0&quot;" isnumberkey="" name="&quot;BX_Size[]&quot;" onblur="&quot;TotalCost(this.id);&quot;" onkeypress="&quot;return" quot="" required="&quot;required&quot;" reset="" txtsize="" type="&quot;text&quot;" value="&quot;23&quot;" /></td>
      <td align="&quot;&quot;" valign="&quot;middle&quot;" width="&quot;500&quot;"><input 60px="" class="&quot;small" id="&quot;txtppua_0&quot;" name="&quot;BX_ppua[]&quot;" onblur="&quot;TotalCost(this.id)&quot;" quot="" required="&quot;required&quot;" reset="" txtppua="" type="&quot;text&quot;" value="&quot;4000&quot;" /></td>
      <td align="&quot;&quot;" valign="&quot;middle&quot;" width="&quot;500&quot;"><select 60px="" class="&quot;BX_bsr" id="&quot;BX_bsr&quot;" name="&quot;BX_bsr[]&quot;" quot="" reset="" tempname="&quot;BX_bsr&quot;">
          <option value="&quot;0&quot;">Select</option>
          <option value="&quot;1&quot;">1</option>
          <option value="&quot;2&quot;">2</option>
          <option selected="&quot;selected&quot;" value="&quot;3&quot;">3</option>
          <option value="&quot;4&quot;">4</option>
          <option value="&quot;5&quot;">5</option>
          <option value="&quot;6&quot;">6</option>
          <option value="&quot;7&quot;">7</option>
          <option value="&quot;8&quot;">8</option>
          <option value="&quot;9&quot;">9</option>
          <option value="&quot;10&quot;">10</option>
        </select></td>
      <td align="&quot;&quot;" valign="&quot;middle&quot;" width="&quot;500&quot;"><select 61px="" class="&quot;BX_svr" id="&quot;BX_svr&quot;" name="&quot;BX_svr[]&quot;" quot="" reset="" tempname="&quot;BX_svr&quot;">
          <option value="&quot;0&quot;">Select</option>
          <option value="&quot;1&quot;">1</option>
          <option value="&quot;2&quot;">2</option>
          <option selected="&quot;selected&quot;" value="&quot;3&quot;">3</option>
          <option value="&quot;4&quot;">4</option>
          <option value="&quot;5&quot;">5</option>
          <option value="&quot;6&quot;">6</option>
          <option value="&quot;7&quot;">7</option>
          <option value="&quot;8&quot;">8</option>
          <option value="&quot;9&quot;">9</option>
          <option value="&quot;10&quot;">10</option>
        </select></td>
      <td align="&quot;&quot;" valign="&quot;middle&quot;" width="&quot;500&quot;"><select 61px="" class="&quot;BX_pr" id="&quot;BX_pr&quot;" name="&quot;BX_pr[]&quot;" quot="" reset="" tempname="&quot;BX_pr">
          <option value="&quot;0&quot;">Select</option>
          <option value="&quot;1&quot;">1</option>
          <option value="&quot;2&quot;">2</option>
          <option selected="&quot;selected&quot;" value="&quot;3&quot;">3</option>
          <option value="&quot;4&quot;">4</option>
          <option value="&quot;5&quot;">5</option>
          <option value="&quot;6&quot;">6</option>
          <option value="&quot;7&quot;">7</option>
          <option value="&quot;8&quot;">8</option>
          <option value="&quot;9&quot;">9</option>
          <option value="&quot;10&quot;">10</option>
        </select></td>
      <td align="&quot;&quot;" valign="&quot;middle&quot;" width="&quot;500&quot;"><select 61px="" class="&quot;BX_fpt" id="&quot;BX_fpt&quot;" name="&quot;BX_fpt[]&quot;" quot="" reset="" tempname="&quot;BX_fpt&quot;">
          <option value="&quot;0&quot;">Select</option>
          <option value="&quot;1&quot;">1</option>
          <option value="&quot;2&quot;">2</option>
          <option selected="&quot;selected&quot;" value="&quot;3&quot;">3</option>
          <option value="&quot;4&quot;">4</option>
          <option value="&quot;5&quot;">5</option>
          <option value="&quot;6&quot;">6</option>
          <option value="&quot;7&quot;">7</option>
          <option value="&quot;8&quot;">8</option>
          <option value="&quot;9&quot;">9</option>
          <option value="&quot;10&quot;">10</option>
        </select></td>
      <td align="&quot;&quot;" valign="&quot;middle&quot;" width="&quot;500&quot;"><input 60px="" bx_tc="" class="&quot;small" id="&quot;BX_tc_0&quot;" name="&quot;BX_tc[]&quot;" quot="" required="&quot;required&quot;" reset="" type="&quot;text&quot;" value="&quot;92000&quot;" /></td>
      <td align="&quot;&quot;" valign="&quot;middle&quot;" width="&quot;500&quot;"><a class="&quot;highslide&quot;" href="https://www.blogger.com/%22OBERNDEV.COM/cfp/11_564_a.jpeg%22" hs.expand="" onclick="&quot;return" quot="" this=""><img align="&quot;absmiddle&quot;" src="&quot;OBERNDEV.COM/images/camera.png&quot;" /></a>
        <input class="&quot;txtbox" name="&quot;image[]&quot;" quot="" reset="" type="&quot;file&quot;" value="&quot;11_564_a.jpeg&quot;" />
        &nbsp;
        <!--  <input type=checkbox name=image_del value=&quot;1&quot; >
          Delete Image--></td>
      <td align="&quot;&quot;" valign="&quot;middle&quot;" width="&quot;500&quot;"></td>
        <br />

    </tr>
<tr>
   
      <td align="&quot;&quot;" valign="&quot;middle&quot;" width="&quot;500&quot;"><a 6px="" class="&quot;ask&quot;" href="https://www.blogger.com/%22configuration_pages_manage.php?property_id=11&amp;del_id=368%22" quot=""><img border="&quot;0&quot;" src="&quot;OBERNDEV.COM/images/trash.png&quot;" /></a>
        <input class="&quot;checkb" id="&quot;1&quot;" name="&quot;chk[]&quot;" none="" quot="" reset="" type="&quot;checkbox&quot;" />
        <input class="&quot;checkb" name="&quot;c_id[]&quot;" quot="" reset="" type="&quot;hidden&quot;" value="&quot;368&quot;" /></td>
      <td align="&quot;&quot;" valign="&quot;middle&quot;" width="&quot;500&quot;"><select 67px="" class="&quot;bed" fillunitname="" id="&quot;bed_1&quot;" name="&quot;BX_Bedrooms[]&quot;" onchange="&quot;show_add(this.id);" quot="" reset="" tempname="&quot;bed&quot;" this.id="">
          <option value="&quot;0&quot;">Select</option>
          <option value="&quot;1&quot;">1</option>
          <option value="&quot;2&quot;">2</option>
          <option value="&quot;3&quot;">3</option>
          <option selected="&quot;selected&quot;" value="&quot;4&quot;">4</option>
          <option value="&quot;5&quot;">5</option>
          <option value="&quot;6&quot;">6</option>
          <option value="&quot;7&quot;">7</option>
          <option value="&quot;8&quot;">8</option>
          <option value="&quot;9&quot;">9</option>
          <option value="&quot;10&quot;">10</option>
        </select></td>
      <td align="&quot;&quot;" valign="&quot;middle&quot;" width="&quot;500&quot;"><select 71px="" class="&quot;bathrooms" id="&quot;bathrooms_1&quot;" name="&quot;BX_Bathrooms[]&quot;" onchange="&quot;fillUnitName(this.id);&quot;" quot="" reset="" tempname="&quot;bathrooms&quot;">
          <option value="&quot;0&quot;">Select</option>
          <option value="&quot;1&quot;">1</option>
          <option value="&quot;2&quot;">2</option>
          <option value="&quot;3&quot;">3</option>
          <option selected="&quot;selected&quot;" value="&quot;4&quot;">4</option>
          <option value="&quot;5&quot;">5</option>
          <option value="&quot;6&quot;">6</option>
          <option value="&quot;7&quot;">7</option>
          <option value="&quot;8&quot;">8</option>
          <option value="&quot;9&quot;">9</option>
          <option value="&quot;10&quot;">10</option>
        </select></td>
      <td align="&quot;&quot;" valign="&quot;middle&quot;" width="&quot;500&quot;"><input 57px="" class="&quot;small" id="&quot;txtUnitName_1&quot;" name="&quot;BX_Unit_Name[]&quot;" onblur="&quot;show_add(this.id);&quot;" quot="" required="&quot;required&quot;" reset="" txtunitname="" type="&quot;text&quot;" value="&quot;4BHK+4T&quot;" /></td>
      <td align="&quot;&quot;" valign="&quot;middle&quot;" width="&quot;500&quot;"><input 55px="" class="&quot;small" event="" id="&quot;txtSize_1&quot;" isnumberkey="" name="&quot;BX_Size[]&quot;" onblur="&quot;TotalCost(this.id);&quot;" onkeypress="&quot;return" quot="" required="&quot;required&quot;" reset="" txtsize="" type="&quot;text&quot;" value="&quot;5000&quot;" /></td>
      <td align="&quot;&quot;" valign="&quot;middle&quot;" width="&quot;500&quot;"><input 60px="" class="&quot;small" id="&quot;txtppua_1&quot;" name="&quot;BX_ppua[]&quot;" onblur="&quot;TotalCost(this.id)&quot;" quot="" required="&quot;required&quot;" reset="" txtppua="" type="&quot;text&quot;" value="&quot;234&quot;" /></td>
      <td align="&quot;&quot;" valign="&quot;middle&quot;" width="&quot;500&quot;"><select 60px="" class="&quot;BX_bsr" id="&quot;BX_bsr&quot;" name="&quot;BX_bsr[]&quot;" quot="" reset="" tempname="&quot;BX_bsr&quot;">
          <option value="&quot;0&quot;">Select</option>
          <option value="&quot;1&quot;">1</option>
          <option value="&quot;2&quot;">2</option>
          <option value="&quot;3&quot;">3</option>
          <option selected="&quot;selected&quot;" value="&quot;4&quot;">4</option>
          <option value="&quot;5&quot;">5</option>
          <option value="&quot;6&quot;">6</option>
          <option value="&quot;7&quot;">7</option>
          <option value="&quot;8&quot;">8</option>
          <option value="&quot;9&quot;">9</option>
          <option value="&quot;10&quot;">10</option>
        </select></td>
      <td align="&quot;&quot;" valign="&quot;middle&quot;" width="&quot;500&quot;"><select 61px="" class="&quot;BX_svr" id="&quot;BX_svr&quot;" name="&quot;BX_svr[]&quot;" quot="" reset="" tempname="&quot;BX_svr&quot;">
          <option value="&quot;0&quot;">Select</option>
          <option value="&quot;1&quot;">1</option>
          <option value="&quot;2&quot;">2</option>
          <option selected="&quot;selected&quot;" value="&quot;3&quot;">3</option>
          <option value="&quot;4&quot;">4</option>
          <option value="&quot;5&quot;">5</option>
          <option value="&quot;6&quot;">6</option>
          <option value="&quot;7&quot;">7</option>
          <option value="&quot;8&quot;">8</option>
          <option value="&quot;9&quot;">9</option>
          <option value="&quot;10&quot;">10</option>
        </select></td>
      <td align="&quot;&quot;" valign="&quot;middle&quot;" width="&quot;500&quot;"><select 61px="" class="&quot;BX_pr" id="&quot;BX_pr&quot;" name="&quot;BX_pr[]&quot;" quot="" reset="" tempname="&quot;BX_pr">
          <option value="&quot;0&quot;">Select</option>
          <option value="&quot;1&quot;">1</option>
          <option selected="&quot;selected&quot;" value="&quot;2&quot;">2</option>
          <option value="&quot;3&quot;">3</option>
          <option value="&quot;4&quot;">4</option>
          <option value="&quot;5&quot;">5</option>
          <option value="&quot;6&quot;">6</option>
          <option value="&quot;7&quot;">7</option>
          <option value="&quot;8&quot;">8</option>
          <option value="&quot;9&quot;">9</option>
          <option value="&quot;10&quot;">10</option>
        </select></td>
      <td align="&quot;&quot;" valign="&quot;middle&quot;" width="&quot;500&quot;"><select 61px="" class="&quot;BX_fpt" id="&quot;BX_fpt&quot;" name="&quot;BX_fpt[]&quot;" quot="" reset="" tempname="&quot;BX_fpt&quot;">
          <option value="&quot;0&quot;">Select</option>
          <option value="&quot;1&quot;">1</option>
          <option selected="&quot;selected&quot;" value="&quot;2&quot;">2</option>
          <option value="&quot;3&quot;">3</option>
          <option value="&quot;4&quot;">4</option>
          <option value="&quot;5&quot;">5</option>
          <option value="&quot;6&quot;">6</option>
          <option value="&quot;7&quot;">7</option>
          <option value="&quot;8&quot;">8</option>
          <option value="&quot;9&quot;">9</option>
          <option value="&quot;10&quot;">10</option>
        </select></td>
      <td align="&quot;&quot;" valign="&quot;middle&quot;" width="&quot;500&quot;"><input 60px="" bx_tc="" class="&quot;small" id="&quot;BX_tc_1&quot;" name="&quot;BX_tc[]&quot;" quot="" required="&quot;required&quot;" reset="" type="&quot;text&quot;" value="&quot;1170000&quot;" /></td>
      <td align="&quot;&quot;" valign="&quot;middle&quot;" width="&quot;500&quot;"><a class="&quot;highslide&quot;" href="https://www.blogger.com/%22OBERNDEV.COM/cfp/11_380_a.jpeg%22" hs.expand="" onclick="&quot;return" quot="" this=""><img align="&quot;absmiddle&quot;" src="&quot;OBERNDEV.COM/images/camera.png&quot;" /></a>
        <input class="&quot;txtbox" name="&quot;image[]&quot;" quot="" reset="" type="&quot;file&quot;" value="&quot;11_380_a.jpeg&quot;" />
        &nbsp;
        <!--  <input type=checkbox name=image_del value=&quot;1&quot; >
          Delete Image--></td>
      <td align="&quot;&quot;" valign="&quot;middle&quot;" width="&quot;500&quot;"></td>
        <br />

    </tr>
</tbody>
</table>
<table>
<tr>
    <td><div 200px="" quot="">
        <input class="&quot;form_submit&quot;" id="&quot;submit&quot;" name="&quot;Submit&quot;" type="&quot;submit&quot;" value="&quot;Update&quot;" />
        &nbsp; <a 0="" 1px="" 2="" 53px="" 7px="" 8px="" bold="" border:="" button.gif="" color:="" font-weight:="" height:="" href="https://www.blogger.com/%22OBERNDEV.COM?property_id=11%22" img="" margin:="" padding:="" quot="" solid="" url="" white="">Next</a> </div>
</td></tr>
</table>

</body>
</html>


--------------------------------------------------------------------------------------------------------------------------

<?php
class infoPage
{
 public $c_id   = array();
 public $property_id  = '';
 public $BX_Bedrooms    = array();
 public $BX_Bathrooms = array();
 public $BX_Unit_Name = array();
 public $BX_Size        = array();
 public $BX_ppua        = array();
 public $BX_bsr        = array();
 public $BX_svr        = array();
 public $BX_pr        = array();
 public $BX_fpt        = array();
 public $BX_tc        = array();
 //public $BX_flpn        = array();
 public $get_data        = array();

 
 public $edit_id    = '';
 public $formTitle  = 'Create';
 public $buttonName = "Create";
 public $action_value  = "";
 
 
 public $objImage       = NULL;
 public $imgPath       = '';
 public $image         = array();
 public $image_del        = array();
 
 function __construct()
 {
  $this->imgPath  = C_SITE_PATH."/".C_CFP_IMAGE."/";
 }
 function setImageObject($objImg = NULL)
 {
  $this->objImage = $objImg;
 }
function getPostValue()
{
  if(isset($_POST['BX_Bedrooms']))
   $this->BX_Bedrooms = $_POST['BX_Bedrooms'];
 if(isset($_POST['property_id']))
   $this->property_id = $_POST['property_id'];
   
  if(isset($_POST['BX_Bathrooms']))
   $this->BX_Bathrooms = $_POST['BX_Bathrooms'];
  
  if(isset($_POST['BX_Unit_Name']))
   $this->BX_Unit_Name = $_POST['BX_Unit_Name'];
  
  if(isset($_POST['BX_Size']))
   $this->BX_Size = $_POST['BX_Size'];
  
  if(isset($_POST['BX_ppua']))
   $this->BX_ppua = $_POST['BX_ppua'];
  
  if(isset($_POST['BX_bsr']))
   $this->BX_bsr = $_POST['BX_bsr'];
  
  if(isset($_POST['BX_svr']))
   $this->BX_svr = $_POST['BX_svr'];
  
  if(isset($_POST['BX_pr']))
   $this->BX_pr = $_POST['BX_pr'];
  
  if(isset($_POST['BX_fpt']))
   $this->BX_fpt = $_POST['BX_fpt'];
  
  if(isset($_POST['BX_tc']))
   $this->BX_tc = $_POST['BX_tc'];
  
  /*if(isset($_POST['BX_flpn']))
   $this->BX_flpn = $_POST['BX_flpn'];*/
   
  if(isset($_POST['c_id']))
   $this->c_id = $_POST['c_id'];
     
  if(isset($_POST['edit_id']))
   $this->edit_id = $_POST['edit_id'];
  
  if(isset($_POST['action_value']))
   $this->action_value = $_POST['action_value'];
   
   
   // images
  if(isset($_FILES['image']))
  {
   $this->image = $_FILES['image'];
  }
  
  if(isset($_POST['image_del']))
  {
   $this->image_del = $_REQUEST['image_del'];
  }
 }
 
function empty_form()
{
  $this->c_id     = array();
  $this->BX_Bedrooms        = array();
  $this->BX_Bathrooms        = array();
  $this->BX_Unit_Name        = array();
  $this->BX_Size         = array();
  $this->BX_ppua         = array();
  $this->BX_bsr         = array();
  $this->BX_svr         = array();
  $this->BX_pr         = array();
  $this->BX_fpt         = array();
  $this->BX_tc         = array();
  //$this->BX_flpn         = array();
  $this->get_data         = array();
  $this->edit_id     = '';
  $this->image        = array();
 }

function getDetails($id)
{
  if(!empty($id))
  {
   $sql = "Select * from T_PROPERTY_CONFIGURATION where property_id='".$id."'";
   $result = mysql_query($sql);
   if($result)
   {
    while($query = mysql_fetch_array($result))
    {
     $this->get_data[]=array(
     
     'c_id'    => stripslashes($query['id']),
     'BX_Bedrooms'   => stripslashes($query['BX_Bedrooms']),
     'BX_Bathrooms'   => stripslashes($query['BX_Bathrooms']),
     'BX_Unit_Name'    => stripslashes($query['BX_Unit_Name']),
     'BX_Size'         => stripslashes($query['BX_Size']),
     'BX_ppua'        => stripslashes($query['BX_ppua']),
     'BX_bsr'    => stripslashes($query['BX_bsr']),
     'BX_svr'     => stripslashes($query['BX_svr']),
     'BX_pr'         => stripslashes($query['BX_pr']),
     'BX_fpt'     => stripslashes($query['BX_fpt']),
     'BX_tc'      => stripslashes($query['BX_tc']),
     'image'       => stripslashes($query['BX_flpn']),
     'property_id'   => $query['property_id']);
    }
    return $this->get_data;
   }
  }
 }
function isDuplicate($id = '')
{
  $sqlStmt = "Select * from T_PROPERTY_CONFIGURATION where  id='".$id."' ";
  
  $result = mysql_query($sqlStmt);
  if($result)
  {
   $num = mysql_num_rows($result);
   
   return $num;
  }
 }
 

function add()
 {
  
   $insertId='';
   
   $i=0;
   foreach($this->BX_Bedrooms as $a => $b){
    
    $this->objImage->image_tmp_name = $this->image['tmp_name'][$a];
    $this->objImage->processImage();
    $image_type   = $this->objImage->getImageType();
    $img_name  = $this->property_id.'_'.rand('1,100').'_a.'.$image_type;
    $targetPath  = $this->imgPath.$img_name;
    $ret    = $this->objImage->saveImage($targetPath, 1);
    //$img_name   = $this->objImage->saveBMP2JPG($this->imgPath,$img_name);   

    $sqlStmt  = "Insert into T_PROPERTY_CONFIGURATION Set ";
    $sqlStmt  .= "  BX_Bedrooms     = '".$this->BX_Bedrooms[$a]."',
        property_id    = '".$this->property_id."',
        BX_Bathrooms    = '".$this->BX_Bathrooms[$a]."',
        BX_Unit_Name    = '".$this->BX_Unit_Name[$a]."',
        BX_Size        = '".$this->BX_Size[$a]."',
        BX_ppua        = '".$this->BX_ppua[$a]."',
        BX_bsr        = '".$this->BX_bsr[$a]."',
        BX_svr       = '".$this->BX_svr[$a]."',
        BX_pr      = '".$this->BX_pr[$a]."',
        BX_fpt      = '".$this->BX_fpt[$a]."',
        BX_tc      = '".$this->BX_tc[$a]."',
        BX_flpn      = '".$img_name."'";
        
        if(mysql_query($sqlStmt))
        {
          $insertId = mysql_insert_id();

        
        }
   
  }
  return $insertId;
  
  
 }
 
function edit()
 {
   
   $i=0;
  
   foreach($this->BX_Bedrooms as $a => $b){
    $tmp_name=$this->image['tmp_name'][$a];
   
    if($this->isDuplicate($this->c_id[$a])>0)
    {
    
       if(!empty($tmp_name))
       {
        $this->saveImage($this->c_id[$a],$tmp_name);
       }   

       $sqlStmt  = "Update  T_PROPERTY_CONFIGURATION Set ";
       $sqlStmt  .= "  BX_Bedrooms     = '".$this->BX_Bedrooms[$a]."',
        property_id    = '".$this->property_id."',
        BX_Bathrooms    = '".$this->BX_Bathrooms[$a]."',
        BX_Unit_Name    = '".$this->BX_Unit_Name[$a]."',
        BX_Size        = '".$this->BX_Size[$a]."',
        BX_ppua        = '".$this->BX_ppua[$a]."',
        BX_bsr        = '".$this->BX_bsr[$a]."',
        BX_svr       = '".$this->BX_svr[$a]."',
        BX_pr      = '".$this->BX_pr[$a]."',
        BX_fpt      = '".$this->BX_fpt[$a]."',
        BX_tc      = '".$this->BX_tc[$a]."'";
        $sqlStmt .= " where id='".$this->c_id[$a]."'";
        if(mysql_query($sqlStmt))
        {
          $insertId = mysql_insert_id();

        }
    }
    else{
     echo $this->isDuplicate($this->c_id[$a]);
     
     $sqlStmt  = "Insert into T_PROPERTY_CONFIGURATION Set ";
       $sqlStmt  .= "  BX_Bedrooms     = '".$this->BX_Bedrooms[$a]."',
        property_id    = '".$this->property_id."',
        BX_Bathrooms    = '".$this->BX_Bathrooms[$a]."',
        BX_Unit_Name    = '".$this->BX_Unit_Name[$a]."',
        BX_Size        = '".$this->BX_Size[$a]."',
        BX_ppua        = '".$this->BX_ppua[$a]."',
        BX_bsr        = '".$this->BX_bsr[$a]."',
        BX_svr       = '".$this->BX_svr[$a]."',
        BX_pr      = '".$this->BX_pr[$a]."',
        BX_fpt      = '".$this->BX_fpt[$a]."',
        BX_tc      = '".$this->BX_tc[$a]."'";
        
        if(mysql_query($sqlStmt))
        {
          echo $insertId = mysql_insert_id();
          $this->saveImage($insertId,$tmp_name);
          echo $tmp_name;

        }
     
     }
   }
 }
function saveImage($insertId,$tmp_name)
 {
  if(!empty($tmp_name))
  {  
   /*Inserting Image*/ 
   $this->objImage->image_tmp_name = $tmp_name;
   $this->objImage->processImage();
   $image_type   = $this->objImage->getImageType();
   $img_name  = $this->property_id.'_'.rand(200,1000).'_a.'.$image_type;
   $targetPath  = $this->imgPath.$img_name;
   $ret    = $this->objImage->saveImage($targetPath, 1);
   if($ret)
   {
     
    $qry1=mysql_query("Update T_PROPERTY_CONFIGURATION Set BX_flpn='".$img_name."' where id='".$insertId."'");
   }
   else
   {
    $this->errorList = $this->objImage->img_error;
   }
  }
 }
 function deleteImage($id)
 {
  $this->deleteSingleImage('BX_flpn', $this->imgPath, $id);
 }
 function deleteSingleImage($fld, $dir, $id)
 {
  if(!empty($fld) && !empty($dir) && !empty($id))
  {
   $sql2    = "Select ".$fld." from T_PROPERTY_CONFIGURATION where property_id='".$id."'";
   $result2 = mysql_query($sql2);
   if($result2)
   {     
    while($query2 = mysql_fetch_array($result2))
    {
     $img_name    = $query2[$fld];
     $targetPath  = $dir.$img_name;
     
     if(file_exists($targetPath) && !empty($img_name))
     { 
      unlink($targetPath);
     }
    }
   }
   
   $qry1 = mysql_query("Update T_PROPERTY Set ".$fld."='' where property_id='".$id."'");
  }
 } 
 
 function deleteImagerow($id)
 {
  $this->deleteSingleImagerow('BX_flpn', $this->imgPath, $id);
 }
 function deleteSingleImagerow($fld, $dir, $id)
 {
  if(!empty($fld) && !empty($dir) && !empty($id))
  {
   $sql2    = "Select ".$fld." from T_PROPERTY_CONFIGURATION where id='".$id."'";
   $result2 = mysql_query($sql2);
   if($result2)
   {     
    while($query2 = mysql_fetch_array($result2))
    {
     $img_name    = $query2[$fld];
     $targetPath  = $dir.$img_name;
     
     if(file_exists($targetPath) && !empty($img_name))
     { 
      unlink($targetPath);
     }
    }
   }
   
   $qry1 = mysql_query("Update T_PROPERTY Set ".$fld."='' where property_id='".$id."'");
  }
 } 
function delete($id)
 {
  $this->deleteImage($id);
  $sql2 = "Delete from T_PROPERTY_CONFIGURATION where property_id='".$id."'";
  
  if(!mysql_query($sql2))
  {
   $this->msg = "Problem to delete data, please try again !!! Error: ". mysql_error();
  }
 }

function deleterow($id)
 {
  $this->deleteImagerow($id);
  $sql2 = "Delete from T_PROPERTY_CONFIGURATION where id='".$id."'";
  
  if(!mysql_query($sql2))
  {
   $this->msg = "Problem to delete data, please try again !!! Error: ". mysql_error();
  }
 }
 
}
?>