Forums

How can I modify this redirection code.

Ron 07 Sep, 2011
Hello,

I have been using chronoforms since almost an year now and every day I learn something more. I am a medical doctor having no knowledge of coding but I am learning and when ever I make something work I feel very happy.😀

This time I want to edit this redirection code that Bob gave me once. It redirects to a chosen page when a selection is made. In this case it is as per country.

<?php
global $mainframe;
$case = JRequest::getString('country', '', 'post');
switch ($case) {
 case 'Afghanistan':
   default:
    $url = 'inr_price_iecp';
    break;
   case 'Akrotiri':
    $url = 'usd_en_200e';
    break;
   case 'Albania':
    $url = 'euro_en_300e';
    break;
   case 'Algeria':
    $url = 'bhd_en_400e';
    break;
}
$url = 'index.php?option=com_chronocontact&chronoformname='.$url;
$mainframe->redirect($url);
?>


When a visitor chooses "Akrotiri" the url is directed to "usd_en_200e". I want to also enable more advanceses like when a country is chosen a state is also required and the redirection is as per country and state together. This I require so that proper more specific reply could be sent as per state of a country.

Could any one help me modify this code.

Thanks in Advance.

Ron
nml375 07 Sep, 2011
Hi Ron,
There's a few approaches to this extention, though they can be grouped in two different categories;
Nesting conditions, and complex conditions.

Nesting conditions simply means that you add a new conditional within each branch of your current structure (think of it as a tree structure; you first select a country-branch, and from there the appropriate state). Code-wize, this would look somewhat like this:
<?php
  global $mainframe;
  $country = JRequest::getString('country', '', 'post');
  $state = JRequest::getString('state', '', 'post');

  switch ($country)
  {
    default:
    case 'Afghanistan':
      switch ($state)
      {
        default:
        case 'Somestate':
          $url = 'inr_price_iepc';
          break;

        case 'Otherstate':
          $url = 'inr_price_other';
          break;
      }
      break;

    case 'Akrotiri':
      switch ($state)
      {
        default:
        case 'YetAnotherState':
          $url = 'usd_en_200e';
          break;

        case 'SomewhereElse':
          $url = 'usd_en_250e';
          break;
      }
      break;
  }

  $url = 'index.php?option=com_chronocontact&chronoformname=' . $url;
  $mainframe->redirect($url);
?>


Complex conditions, on the other hand, means that you specify all the criterias for a single selection; such as
If country is 'Afghanistan' And state is 'Somestate' Then set $url to 'inr_price_iepc'.
Else If country is 'Afghanistan' And state is 'Otherstate' Then set $url to 'inr_price_other'
. And so on..

In your case, I believe nesting conditionals would be the simplest approach for you; it's roughly put merely a matter of writing switch()-blocks within other switch()-blocks. Especially, if you have two regions of multiple states in the same country, you could use the "fall-through" mechanism in switch(), like below:
<?php
....
/* Skipping some code, assuming we've got $country and $state set already, and we've branched into $country == 'Utopia'
 * Where State1, State2, State3, and State7 belong to Region 1,
 * State4, State5, and State6 belong to Region 2
 */
  switch ($state)
  {
    case 'State1':
    case 'State2':
    case 'State3':
    case 'State7':
      $url = 'utopia_1';
      break;

    case 'State4':
    case 'State5':
    case 'State6':
      $url = 'utopia_2';
      break;

    default:
      //We don't know about this state, use region_unknown
      $url = 'utopia_unknown';
  }
// Rest of code should follow...


/Fredrik
Ron 08 Sep, 2011
Thanks fredrik,

That was brilliant. I feel the second option would be simpler for me. I thank you so much for your answer.
I also want to hide the code of one of my forms so that it cannot be viewed in the source code. Is there a way please !

Best wishes

Ron😀
nml375 08 Sep, 2011
Hi Ron,
Well, generally no.

Php-code would obviously not be shown to the end user (unless the web server is badly configured). As for the javascripts and html-code used to render the page in the browser, these has to be readable by the browser, and hence the "show source" command would always show the rendered source, as provided by the server.

With Javascripts, you can use techniques such as obfuscating to make it harder for a human mind to read the code. However, there are plenty of tools out there to easily de-obfuscate such scripts.

Then there are tools such as FireBug, which accesses the DOM (document object model) of the loaded page, allowing it to show what the browser thinks is the current page - very helpful for debugging dynamic pages using javascripts (such as the client-side validation in chronoforms).

/Fredrik
Ron 10 Sep, 2011
I thing some cheap spammers are using this site to advertisement. Better update the banned IP list you can get it from http://www.stopforumspam.com/

This is annoying. These bloody Spammers

Ron
Ron 11 Sep, 2011
Hello Fredrik

I deleted it. Sorry I put the wrong form. I will upload the right one. It is big so will have to upload in two sections.

Thanks anyway for the support.

Ron
nml375 11 Sep, 2011
Hi Ron,
I'm afraid the posted code works perfectly fine for me, when used in the "on submit - after email" entry (using CFv3.1 and Jv1.5).

Could you try enabling form debugging, and temporarily replace the "$mainframe->redirect($url);" command with "echo($url);"
This should show us whether the it's the "selection-logic" that's failing, or the redirect code.

/Fredrik
Ron 11 Sep, 2011
Hello Fredrik
Thanks for all the support. I am uploading a form which I edited to work in Chronoforms it is a dropdown for Region-Country and city:

The form HTML is as under:
<div id="widget">

<p>Please Select your Region or Continent:  <select onchange="set_country(this,country,city_state)" size="1" name="region">
<option value="" selected="selected">Select an Option</option>
<option value=""></option>

setRegions(this);
</script>
</select>  
<p>Please Select your Country:                  <select name="country" id="country" size="1" disabled="disabled" onchange="set_city_state(this,city_state)"></select></p>
<p>Please Select your City or State:           <select name="city_state" id="city_state" size="1" disabled="disabled" onchange="print_city_state(country,this)"></select></p>

 
  </div>


The next post:
Ron 11 Sep, 2011
The form Java script is as under:
////////////////////////////////////////////////////////////////////////////
// city_state.js ///////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////

var countries = Object();

countries['Africa'] = '|Algeria|Angola|Benin|Botswana|Burkina Faso|Burundi|Cameroon|Cape Verde|Central African Republic|Chad|Comoros|Congo, Dem.|Congo, Rep.|Djibouti|Egypt|Equatorial Guinea|Eritrea|Ethiopia|Gabon|Gambia|Ghana|Guinea|Guinea-Bissau|Kenya|Lesotho|Liberia|Libya|Madagascar|Malawi|Mali|Mauritania|Mauritius|Morocco|Mozambique
|Namibia|Niger|Nigeria|Rwanda|Sao Tome/Principe|Senegal|Seychelles|Sierra Leone|Somalia|South Africa|Sudan|Swaziland|Tanzania|Togo|Tunisia|Uganda|Zambia|Zimbabwe';
countries['Antarctica'] = '|Amundsen-Scott';
countries['Asia'] = '|Bangladesh|Bhutan|Brunei|Burma (Myanmar)|Cambodia|China|East Timor|India|Indonesia|Japan|Kazakhstan|Korea (north)|Korea (south)|Laos|Malaysia|Maldives|Mongolia|Nepal|Philippines|Russian Federation|Singapore|Sri Lanka|Taiwan|Thailand|Vietnam';
countries['Australia/Oceania'] = '|Australia|Fiji|Kiribati|Micronesia|Nauru|New Zealand|Palau|Papua New Guinea|Samoa|Tonga|Tuvalu|Vanuatu';


////////////////////////////////////////////////////////////////////////////

var city_states = Object();

//Africa
city_states['Algeria'] = '|Algiers||Adrar|Ain Defla|Ain Temouchent|Alger|Annaba|Batna|Bechar|Bejaia|Biskra|Blida|Bordj Bou Arreridj|Bouira|Boumerdes|Chlef|Constantine|Djelfa|El Bayadh|El Oued|El Tarf|Ghardaia|Guelma|Illizi|Jijel|Khenchela|Laghouat|Mascara|Medea|Mila|Mostaganem|M\'Sila|Naama
|Oran|Ouargla|Oum el Bouaghi|Relizane|Saida|Setif|Sidi Bel Abbes|Skikda|Souk Ahras|Tamanghasset|Tebessa|Tiaret|Tindouf|Tipaza|Tissemsilt|Tizi Ouzou|Tlemcen';
city_states['Angola'] = '|Luanda||Bengo|Benguela|Bie|Cabinda|Cuando Cubango|Cuanza Norte|Cuanza Sul|Cunene|Huambo|Huila|Lunda Norte|Lunda Sul|Malanje|Moxico|Namibe|Uige|Zaire';
city_states['Benin'] = '|Porto-Novo||Alibori|Atakora|Atlantique|Borgou|Collines|Couffo|Donga|Littoral|Mono|Oueme|Plateau|Zou';
city_states['Botswana'] = '|Gaborone||Central|Chobe|Francistown|Ghanzi|Kgalagadi|Kgatleng|Kweneng|Lobatse|Ngamiland|North-East|Selebi-Pikwe|South-East|Southern';
city_states['Burkina Faso'] = '|Ouagadougou||Bale|Bam|Banwa|Bazega|Bougouriba|Boulgou|Boulkiemde|Comoe|Ganzourgou|Gnagna|Gourma
|Houet|Ioba|Kadiogo|Kenedougou|Komandjari|Kompienga|Kossi|Koupelogo|Kouritenga|Kourweogo|Leraba
|Loroum|Mouhoun|Nahouri|Namentenga|Nayala|Naumbiel|Oubritenga|Oudalan|Passore|Poni|Samentenga
|Sanguie|Seno|Sissili|Soum|Sourou|Tapoa|Tuy|Yagha|Yatenga|Ziro|Zondomo|Zoundweogo';
city_states['Burundi'] = '|Bujumbura||Bubanza|Bujumbura|Bururi|Cankuzo|Cibitoke|Gitega|Karuzi|Kayanza|Kirundo|Makamba
|Muramvya|Muyinga|Mwaro|Ngozi|Rutana|Ruyigi';
city_states['Cameroon'] = '|Yaounde||Adamaoua|Centre|Est|Extreme-Nord|Littoral|Nord|Nord-Ouest|Ouest|Sud|Sud-Ouest';
city_states['Cape Verde'] = '|Praia||Boa Vista|Brava|Calheta|Maio|Mosteiros|Paul|Porto Novo|Ribeira Grande|Sal|Santa Catarina|Santa Cruz|Sao Domingos|Sao Nicolau|Sao Filipe|Sao Vicente|Tarrafal';
city_states['Central African Republic'] = '|Bangui||Bamingui-Bangoran|Basse-Kotto|Gribingui
|Haute-Kotto|Haute-Sangha|Haut-Mbomou|Kemo-Gribingui|Lobaye|Mbomou|Nana-Mambere|Ombella-Mpoko|Ouaka|Ouham|Ouham-Pende|Sangha|Vakaga';
city_states['Chad'] = '|N\'Djamena||Assongha|Baguirmi|Bahr El Gazal|Bahr Koh|Batha Oriental
|Batha Occidental|Biltine|Borkou|Dababa|Ennedi|Guera|Hadjer Lamis|Kabia|Kanem|Lac|Lac Iro|Logone Occidental|Logone Oriental|Mandoul|Mayo-Boneye|Mayo-Dallah|Monts de Lam|Ouaddai|Salamat|Sila|Tandjile Oriental|Tandjile Occidental|Tibesti';
city_states['Congo, Dem.'] = '|Kinshasa||Bandundu|Bas-Congo|Equateur|Kasai-Occidental|Kasai-Oriental|Katanga|Maniema|Nord-Kivu|Orientale|Sud-Kivu';
city_states['Congo, Rep.'] = '|Brazzaville||Bouenza|Cuvette|Kouilou|Lekoumou|Likouala|Niari|Plateaux|Pool|Sangha';
city_states['Djibouti'] = '|Djibouti||\'Ali Sabih|Dikhil|Obock|Tadjoura';
city_states['Egypt'] = '|Cairo||Ad Daqahliyah|Al Bahr al Ahmar|Al Buhayrah|Al Fayyum|Al Gharbiyah|Al Iskandariyah|Al Isma\'iliyah|Al Jizah|Al Minufiyah|Al Minya|Al Qahirah|Al Qalyubiyah|Al Wadi al Jadid|Ash Sharqiyah|As Suways|Aswan|Asyut|Bani Suwayf|Bur Sa\'id|Dumyat|Janub Sina\'|Kafr ash Shaykh|Matruh|Qina|Shamal Sina\'|Suhaj';
city_states['Equatorial Guinea'] = '|Malabo||Annobon|Bioko Norte|Bioko Sur|Centro Sur|Kie-Ntem|Litoral|Wele-Nzas';
city_states['Eritrea'] = '|Asmara||Central|Anelba|Southern Red Sea|Northern Red Sea|Southern
|Gash-Barka';
city_states['Ethiopia'] = '|Addis Ababa||Adis Abeba (Addis Ababa)|Afar|Amara|Binshangul Gumuz
|Dire Dawa|Gambela Hizboch|Hareri Hizb|Oromiya|Sumale (Somali)|Tigray|YeDebub Biheroch Bihereseboch...';
city_states['Gabon'] = '|Libreville';
city_states['Gambia'] = '|Estuaire|Haut-Ogooue|Moyen-Ogooue|Ngounie|Nyanga|Ogooue-Ivindo|Ogooue-Lolo|Ogooue-Maritime|Woleu-Ntem';
city_states['Ghana'] = '|Accra||Ashanti|Brong-Ahafo|Central|Eastern|Northern|Upper East|Upper West|Volta|Western';
city_states['Guinea'] = '|Conakry||Beyla|Boffa|Boke|Coyah|Dabola|Dalaba|Dinguiraye|Dubreka|Faranah|Forecariah|Fria
|Gaoual|Gueckedou|Kankan|Kerouane|Kindia|Kissidougou|Koubia|Koundara|Kouroussa|Labe|Lelouma
|Lola|Macenta|Mali|Mamou|Mandiana|Nzerekore|Pita|Siguiri|Telimele|Tougue|Yomou';
city_states['Guinea-Bissau'] = '|Bissau||Bafata|Biombo|Bolama/Bijagos|Cacheu|Gabu|Oio|Quinara|Tombali';
city_states['Kenya'] = '|Nairobi||Central|Coast|Eastern|Nairobi Area|North Eastern|Nyanza|Rift Valley|Western';
city_states['Lesotho'] = '|Maseru||Berea|Butha-Buthe|Leribe|Mafeteng|Mohales Hoek|Mokhotlong|Qacha\'s Nek|Quthing|Thaba-Tseka';
city_states['Liberia'] = '|Monrovia||Bomi|Bong|Gparbolu|Grand Bassa|Grand Cape Mount|Grand Gedeh|Grand Kru|Lofa|Margibi|Maryland|Montserrado|Nimba|River Cess|River Gee|Sinoe';
city_states['Libya'] = '|Tripoli||Ajdabiya|Al \'Aziziyah|Al Fatih|Al Jabal al Akhdar|Al Jufrah
|Al Khums|Al Kufrah|An Nuqat al Khams|Ash Shati\'|Awbari|Az Zawiyah|Banghazi|Darnah|Ghadamis|Gharyan|Misratah|Murzuq|Sabha|Sawfajjin|Surt|Tarabulus|Tarhunah
|Tubruq|Yafran|Zlitan';
city_states['Madagascar'] = '|Antananarivo||Antsiranana|Fianarantsoa|Mahajanga|Toamasina|Toliara';
city_states['Malawi'] = '|Lilongwe||Balaka|Blantyre|Chikwawa|Chiradzulu|Chitipa|Dedza|Dowa|Karonga|Kasungu|Likoma|Machinga (Kasupe)|Mangochi|Mchinji|Mulanje|Mwanza|Mzimba|Ntcheu|Nkhata Bay|Nkhotakota|Nsanje|Ntchisi|Phalombe|Rumphi|Salima|Thyolo|Zomba';
city_states['Mali'] = '|Bamako||Gao|Kayes|Kidal|Koulikoro|Mopti|Segou|Sikasso|Tombouctou';
city_states['Mauritania'] = '|Nouakchott||Adrar|Assaba|Brakna|Dakhlet Nouadhibou|Gorgol|Guidimaka|Hodh Ech Chargui|Hodh El Gharbi|Inchiri|Tagant|Tiris Zemmour|Trarza';
city_states['Mauritius'] = '|Port Louis||Agalega Islands|Black River|Cargados Carajos Shoals|Flacq|Grand Port|Moka|Pamplemousses|Plaines Wilhems|Riviere du Rempart|Rodrigues|Savanne';
city_states['Morocco'] = '|Rabat||Ad Dakhla (Oued Eddahab)|Agadir|Al Hoceima|Azilal|Beni Mellal|Ben Slimane|Boujdour|Boulemane|Casablanca|Chaouen|El Jadida|El Kelaa des Sraghna|Er Rachidia|Essaouira|Es Smara|Fes|Figuig|Guelmim|Ifrane|Kenitra|Khemisset|Khenifra|Khouribga|Laayoune|Larache|Marrakech
|Meknes|Nador|Ouarzazate|Oujda|Safi|Settat|Sidi Kacem|Tanger|Tan-Tan|Taounate|Taroudannt|Tata|Taza|Tetouan|Tiznit';
city_states['Mozambique'] = '|Maputo||Cabo Delgado|Gaza|Inhambane|Manica|Maputo|Nampula|Niassa|Sofala|Tete|Zambezia';
city_states['Namibia'] = '|Windhoek||Caprivi|Erongo|Hardap|Karas|Khomas|Kunene|Ohangwena|Okavango|Omaheke|Omusati|Oshana
|Oshikoto|Otjozondjupa';
city_states['Niger'] = '|Niamey||Agadez|Diffa|Dosso|Maradi|Tahoua|Tillaberi|Zinder';
city_states['Nigeria'] = '|Abuja||Abia|Adamawa|Akwa Ibom|Anambra|Bauchi|Bayelsa|Benue|Borno
|Cross River|Delta|Ebonyi|Edo|Ekiti|Enugu|Gombe|Imo|Jigawa|Kaduna|Kano|Katsina|Kebbi|Kogi|Kwara|Lagos
|Nassarawa|Niger|Ogun|Ondo|Osun|Oyo|Plateau|Rivers|Sokoto|Taraba|Yobe|Zamfara';
city_states['Rwanda'] = '|Kigali||Butare|Byumba|Cyangugu|Gikongoro|Gisenyi|Gitarama|Kibungo|Kibuye|Ruhengeri|Umutara';
city_states['Sao Tome/Principe'] = '|Sao Tome||Principe';
city_states['Senegal'] = '|Dakar||Diourbel|Fatick|Kaolack|Kolda|Louga|Matam|Saint-Louis|Tambacounda|Thies|Ziguinchor';
city_states['Seychelles'] = '|Victoria||Anse aux Pins|Anse Boileau|Anse Etoile|Anse Louis|Anse Royale|Baie Lazare|Baie Sainte Anne|Beau Vallon|Bel Air|Bel Ombre|Cascade|Glacis|Grand\' Anse (on Mahe)|Grand\' Anse (on Praslin)|La Digue|La Riviere Anglaise|Mont Buxton|Mont Fleuri|Plaisance|Pointe La Rue|Port Glaud|Saint Louis|Takamaka';
city_states['Sierra Leone'] = '|Freetown||Eastern|Northern|Southern|Western';



//Asia
city_states['Bangladesh'] = '|Dhaka||Barisal|Chittagong|Khulna|Rajshahi|Sylhet';
city_states['Bhutan'] = '|Thimphu||Bumthang|Chhukha|Chirang|Dagana|Gasa|Geylegphug|Ha|Lhuntshi|Mongar|Paro|Pemagatsel
|Punakha|Samchi|Samdrup Jongkhar|Shemgang|Tashigang|Tongsa|Wangdi Phodrang|Yangtse';
city_states['Brunei'] = '|Bandar Seri Begawan||Belait|Brunei/Muara|Temburong|Tutong';
city_states['Burma (Myanmar)'] = '|Rangoon||Ayeyarwady|Bago|Chin|Kachin|Kayin|Kayah|Magway|Mandalay|Mon|Rakhine|Sagaing|Shan
|Tanintharyi|Yangon';
city_states['Cambodia'] = '|Phnom Penh||Banteay Mean Cheay|Batdambang|Kampong Cham|Kampong Chhnang|Kampong Spoe|Kampong Thum|Kampot|Kandal|Kaoh Kong|Keb|Kracheh|Mondol Kiri|Otdar Mean Cheay|Pailin|Pouthisat|Preah Seihanu (Sihanoukville)|Preah Vihear|Prey Veng|Rotanah Kiri|Siem Reab|Stoeng Treng|Svay Rieng|Takev';
city_states['China'] = '|Beijing||Anhui|Chongqing|Fujian|Gansu|Guangdong|Guangxi|Guizhou|Hainan|Hebei|Heilongjiang
|Henan|Hubei|Hunan|Jiangsu|Jiangxi|Jilin|Liaoning|Nei Mongol|Ningxia|Qinghai|Shaanxi|Shandong|Shanghai|Shanxi|Sichuan|Tianjin|Xinjiang|Xizang (Tibet)|Yunnan|Zhejiang';
city_states['East Timor'] = '|Dili||Aileu|Ainaro|Baucau|Bobonaro (Maliana)|Cova-Lima (Suai)|Ermera|Lautem (Los Palos)|Liquica|Manatuto|Manufahi (Same)|Oecussi (Ambeno)|Viqueque';



//Australia-Oceania
city_states['Australia'] = '|Canberra||Australian Capital Territory|New South Wales|Northern Territory|Queensland|South Australia|Tasmania|Victoria|Western Australia';
city_states['Fiji'] = '|Suva||Central|Eastern|Northern|Rotuma|Western';


//Caribbean
city_states['Anguilla'] = '|The Valley';
city_states['Antigua/Barbuda'] = '|Saint John||Barbuda|Redonda|Saint George|Saint Mary|Saint Paul|Saint Peter|Saint Philip';
city_states['Aruba'] = '|Oranjestad';
city_states['Bahamas'] = '|Nassau||Acklins/Crooked Islands|Bimini|Cat Island|Exuma|Freeport|Fresh Creek|Governor\'s Harbour|Green Turtle Cay|Harbour Island|High Rock|Inagua|Kemps Bay|Long Island|Marsh Harbour|Mayaguana|New Providence|Nichollstown/Berry Islands|Ragged Island|Rock Sound|Sandy Point|San Salvador/Rum Cay';
city_states['Barbados'] = '|Bridgetown||Christ Church|Saint Andrew|Saint George|Saint James|Saint John|Saint Joseph|Saint Lucy|Saint Michael|Saint Peter|Saint Philip|Saint Thomas';



//Central America
city_states['Belize'] = '|Belmopan||Belize|Cayo|Corozal|Orange Walk|Stann Creek|Toledo';
city_states['Costa Rica'] = '|San Jose||Alajuela|Cartago|Guanacaste|Heredia|Limon|Puntarenas';
city_states['El Salvador'] = '|San Salvador||Ahuachapan|Cabanas|Chalatenango|Cuscatlan|La Libertad|La Paz|La Union|Morazan|San Miguel|Santa Ana|San Vicente|Sonsonate|Usulutan';



//Europe
city_states['Albania'] = '|Tirana||Berat|Bulqize|Delvine|Devoll|Diber|Durres|Elbasan|Fier|Gjirokaster|Gramsh|Has|Kavaje
|Kolonje|Korce|Kruje|Kucove|Kukes|Kurbin|Lezhe|Librazhd|Lushnje|Malesi e Madhe|Mallakaster|Mat|Mirdite|Peqin|Permet|Pogradec|Puke|Sarande|Shkoder|Skrapar|Tepelene|Tirane
|Tropoje|Vlore';
city_states['Andorra'] = '|Andorra la Vella||Canillo|Encamp|La Massana|Escaldes-Engordany|Ordino|Sant Julia de Loria';
city_states['Austria'] = '|Vienna||Burgenland|Kaernten|Niederoesterreich|Oberoesterreich|Salzburg|Steiermark|Tirol
|Vorarlberg|Wien';
city_states['Belarus'] = '|Minsk||Brest|Homyel\'|Horad Minsk||Hrodna|Mahilyow|Vitsyebsk';
city_states['Belgium'] = '|Brussels||Antwerpen|Brabant Wallon|Brussels (Bruxelles)|Hainaut|Liege|Limburg|Luxembourg|Namur|Oost-Vlaanderen|Vlaams-Brabant|West-Vlaanderen';
city_states['Bosnia/Herzegovina'] = '|Sarajevo';

city_states['Vatican City'] = '';



////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////

function setRegions()
{
	for (region in countries)
		document.write('<option value="' + region + '">' + region + '</option>');
}

function set_country(oRegionSel, oCountrySel, oCity_StateSel)
{
	var countryArr;
	oCountrySel.length = 0;
	oCity_StateSel.length = 0;
	var region = oRegionSel.options[oRegionSel.selectedIndex].text;
	if (countries[region])
	{
		oCountrySel.disabled = false;
		oCity_StateSel.disabled = true;
		oCountrySel.options[0] = new Option('Select your Country','');
		countryArr = countries[region].split('|');
		for (var i = 0; i < countryArr.length; i++)
			oCountrySel.options[i + 1] = new Option(countryArr[i], countryArr[i]);
		document.getElementById('txtregion').innerHTML = region;
		document.getElementById('txtplacename').innerHTML = '';
	}
	else oCountrySel.disabled = true;
}

function set_city_state(oCountrySel, oCity_StateSel)
{
	var city_stateArr;
	oCity_StateSel.length = 0;
	var country = oCountrySel.options[oCountrySel.selectedIndex].text;
	if (city_states[country])
	{
		oCity_StateSel.disabled = false;
		oCity_StateSel.options[0] = new Option('Select your State','');
		city_stateArr = city_states[country].split('|');
		for (var i = 0; i < city_stateArr.length; i++)
			oCity_StateSel.options[i+1] = new Option(city_stateArr[i],city_stateArr[i]);
		document.getElementById('txtplacename').innerHTML = country;
	}
	else oCity_StateSel.disabled = true;
}

function print_city_state(oCountrySel, oCity_StateSel)
{
	var country = oCountrySel.options[oCountrySel.selectedIndex].text;
	var city_state = oCity_StateSel.options[oCity_StateSel.selectedIndex].text;
	if (city_state && city_states[country].indexOf(city_state) != -1)
		document.getElementById('txtplacename').innerHTML = city_state + ', ' + country;
	else document.getElementById('txtplacename').innerHTML = country;
}


I had to delete a lot of data as it does not fit in due to limitation : (Your message contains 62145 characters. The maximum number of allowed characters is 60000.)

My redirection code is as under:

<?php
      global $mainframe;
      $country = JRequest::getString('country', '', 'post');
      $state = JRequest::getString('city_state', '', 'post');

      switch ($country)
      {
        default:
        case 'Afghanistan':
      switch ($state)
      {
        case 'Balkh':
        case 'Herat':

          $url = '51-saarc-price-quotes.html';
          break;

        case 'Kabol':
        case 'Qandahar':
          $url = '51-saarc-price-quotes.html';
          break;
      }
        default:
          //We don't know about this state, use region_unknown
          $url = '46-international-prices.html';
		  
   case 'Akrotiri':
    $url = '46-international-prices.html';
    break;
   case 'Albania':
    $url = '123-price-quotes-in-europe.html';
    break;
   case 'Algeria':
    $url = '125-price-quotes-in-african-continent.html';
    break;
	  case 'India':
      switch ($state)
      {
        case 'Andaman and Nicobar Islands':
        case 'Andhra Pradesh':
        case 'Arunachal Pradesh':
        case 'Assam':
        case 'Bihar':
        case 'Chandigarh':
        case 'Chhattisgarh': 
        case 'Dadra and Nagar Haveli':
        case 'Daman and Diu':
        case 'Delhi':
        case 'Goa':
        case 'Gujarat':
        case 'Haryana':
        case 'Jammu and Kashmir':
        case 'Jharkhand':
        case 'Karnataka':
        case 'Kerala':
        case 'Lakshadweep':
        case 'Madhya Pradesh':
        case 'Manipur':
        case 'Meghalaya':
        case 'Mizoram':
        case 'Nagaland':
        case 'Orissa':
        case 'Pondicherry':
        case 'Punjab': 
        case 'Rajasthan':
        case 'Sikkim':
        case 'Tamil Nadu':
        case 'Tripura':
        case 'Uttarakhand':
        case 'Uttar Pradesh':
        case 'West Bengal':

          $url = '51-saarc-price-quotes.html';
          break;
     
        case 'Himachal Pradesh':
          $url = '130-price-quotes-in-indian-state-of-himachal-pradesh.html';
          break;
		  
	    case 'Maharashtra':
          $url = '127-price-quote-for-maharashtra.html';
          break;
       }
        default:
          //We don't know about this state, use region_unknown
          $url = '46-international-prices.html';
     break;
      }

$url = 'http://xyz.com/component/content/article/34-xyz-articles/'.$url;
$mainframe->redirect($url);
?>


I am only able to redirect to countries but not to states. where I may be going wrong. Would you please suggest.

Thanks for the help

Ron
nml375 12 Sep, 2011
Hi Ron,
At a first glance, you had multiple "default:" cases (matches anything except already included cases), which isn't such a good idea.
Further, your braces were somewhat mis-aligned. The corrected code is below:
<?php
global $mainframe;
$country = JRequest::getString('country', '', 'post');
$state = JRequest::getString('city_state', '', 'post');

switch($country)
{
	case 'Afghanistan':
		switch ($state)
		{
			case 'Balkh':
			case 'Herat':
			case 'Kabol':
			case 'Qandahar':
				$url = '51-saarc-price-quotes.html';
				break;

			default:
				//We don't know about this state, use region_unknown
				$url = '46-international-prices.html';
		}
		break;

	case 'Akrotiri':
		$url = '46-international-prices.html';
		break;

	case 'Albania':
		$url = '123-price-quotes-in-europe.html';
		break;

	case 'Algeria':
		$url = '125-price-quotes-in-african-continent.html';
		break;

	case 'India':
		switch ($state)
		{
			case 'Andaman and Nicobar Islands':
			case 'Andhra Pradesh':
			case 'Arunachal Pradesh':
			case 'Assam':
			case 'Bihar':
			case 'Chandigarh':
			case 'Chhattisgarh':
			case 'Dadra and Nagar Haveli':
			case 'Daman and Diu':
			case 'Delhi':
			case 'Goa':
			case 'Gujarat':
			case 'Haryana':
			case 'Jammu and Kashmir':
			case 'Jharkhand':
			case 'Karnataka':
			case 'Kerala':
			case 'Lakshadweep':
			case 'Madhya Pradesh':
			case 'Manipur':
			case 'Meghalaya':
			case 'Mizoram':
			case 'Nagaland':
			case 'Orissa':
			case 'Pondicherry':
			case 'Punjab':
			case 'Rajasthan':
			case 'Sikkim':
			case 'Tamil Nadu':
			case 'Tripura':
			case 'Uttarakhand':
			case 'Uttar Pradesh':
			case 'West Bengal':
				$url = '51-saarc-price-quotes.html';
				break;

			case 'Himachal Pradesh':
				$url = '130-price-quotes-in-indian-state-of-himachal-pradesh.html';
				break;

			case 'Maharashtra':
				$url = '127-price-quote-for-maharashtra.html';
				break;

			default:
				//We don't know about this state, use region_unknown
				$url = '46-international-prices.html';
		}
		break;
	default:
		$url = '46-international-prices.html';
}

$url = 'http://xyz.com/component/content/article/34-xyz-articles/' . $url;
$mainframe->redirect($url);
?>
Ron 01 Oct, 2011
Thanks nml375,

This code works perfectly in V3. But in V4 it does not work. Rather none of my codes work in V4.
Is there a special way of making the code either before of after email work ? The Javascript also do not work in V4.

Ron 😶
GreyHead 01 Oct, 2011
Hi Ron,

If you are using Joomla! 1.6/1.7 then global $mainframe; no longer works. Use $mainframe =& JFactory::getApplication(); instead.

I don't see anything else odd in the PHP. Haven't tried to look at the JavaScript - your script debugger may give you a clue about problems there.

Bob
Ron 01 Oct, 2011
Thanks Bob.

I am going to try that out.

Ron🙂
Ron 01 Oct, 2011
I am getting the following error on submit:
Notice: Use of undefined constant HTTP_X_FORWARDED_FOR - assumed 'HTTP_X_FORWARDED_FOR' in /home/xxxx/public_html/test/administrator/components/com_chronoforms/form_actions/show_html/cfaction_show_html.php(102) : eval()'d code on line 134

Notice: Use of undefined constant REMOTE_ADDR - assumed 'REMOTE_ADDR' in /home/xxxx/public_html/test/administrator/components/com_chronoforms/form_actions/show_html/cfaction_show_html.php(102) : eval()'d code on line 137


I don't understand this.

Please help

Ron
nml375 01 Oct, 2011
Hi Ron,
That is not really an error (it will not terminate the script), but a notice that the code isn't quite valid - though Php thinks it can guess what you actually intended to do.

In this case, you've entered a string without enclosing it with quotes (" or '). Thus, php looks for a constant with the same name, but can't find it. It then assumes you've forgotten the quotes, and hands you a notice so you can fix your code.

Looking at the names, it suggests to me that you're testing some request headers, and is using a piece of code somewhat like this:
...
if ($_SERVER[REMOTE_ADDR] == '192.168.1.1')
...

The proper way to write this, would be as follows:
...
if ($_SERVER['REMOTE_ADDR'] == '192.168.1.1')
...


/Fredrik
Ron 02 Oct, 2011
Thanks Fredrik,

There was an error in the .js file which was not a proper upload. After I re-uploaded the error went away. Thanks a Lot.


Hi Ron,
At a first glance, you had multiple "default:" cases (matches anything except already included cases), which isn't such a good idea.
Further, your braces were somewhat mis-aligned. The corrected code is below:

<?php
global $mainframe;
$country = JRequest::getString('country', '', 'post');
$state = JRequest::getString('city_state', '', 'post');

switch($country)
{
	case 'Afghanistan':
		switch ($state)
		{
			case 'Balkh':
			case 'Herat':
			case 'Kabol':
			case 'Qandahar':
				$url = '51-saarc-price-quotes.html';
				break;

			default:
				//We don't know about this state, use region_unknown
				$url = '46-international-prices.html';
		}
		break;

	case 'Akrotiri':
		$url = '46-international-prices.html';
		break;

	case 'Albania':
		$url = '123-price-quotes-in-europe.html';
		break;

	case 'Algeria':
		$url = '125-price-quotes-in-african-continent.html';
		break;

	case 'India':
		switch ($state)
		{
			case 'Andaman and Nicobar Islands':
			case 'Andhra Pradesh':
			case 'Arunachal Pradesh':
			case 'Assam':
			case 'Bihar':
			case 'Chandigarh':
			case 'Chhattisgarh':
			case 'Dadra and Nagar Haveli':
			case 'Daman and Diu':
			case 'Delhi':
			case 'Goa':
			case 'Gujarat':
			case 'Haryana':
			case 'Jammu and Kashmir':
			case 'Jharkhand':
			case 'Karnataka':
			case 'Kerala':
			case 'Lakshadweep':
			case 'Madhya Pradesh':
			case 'Manipur':
			case 'Meghalaya':
			case 'Mizoram':
			case 'Nagaland':
			case 'Orissa':
			case 'Pondicherry':
			case 'Punjab':
			case 'Rajasthan':
			case 'Sikkim':
			case 'Tamil Nadu':
			case 'Tripura':
			case 'Uttarakhand':
			case 'Uttar Pradesh':
			case 'West Bengal':
				$url = '51-saarc-price-quotes.html';
				break;

			case 'Himachal Pradesh':
				$url = '130-price-quotes-in-indian-state-of-himachal-pradesh.html';
				break;

			case 'Maharashtra':
				$url = '127-price-quote-for-maharashtra.html';
				break;

			default:
				//We don't know about this state, use region_unknown
				$url = '46-international-prices.html';
		}
		break;
	default:
		$url = '46-international-prices.html';
}

$url = 'http://xyz.com/component/content/article/34-xyz-articles/' . $url;
$mainframe->redirect($url);
?>


There is one more question I want to know In the above mentioned code that you mentioned. Is it possible I can add more parameters for example:

$country = JRequest::getString('country', '', 'post');
$state = JRequest::getString('city_state', '', 'post');
$equipment = JRequest::getString('equipment', '', 'post');
$currency = JRequest::getString('currency', '', 'post');


If I have to do that how can I narrow down my redirection to a particular address? Could you please modify that code please... I am a dummy as far as codes are concerned. But these things excite me.

Thanks again.

Ron
nml375 02 Oct, 2011
Hi Ron,
There's really no limit (other than memory and such) as to how many levels of conditionals you may nest. There is also no restrictions on which kind of conditionals you nest (if/else, switch, etc).

A conditional is in its simplest essence, a test, and a piece of code to be executed if the test is "true". This applies to the switch command, though it has a few behaviours you need to be aware of.
Switches has two blocks, the value to be tested, and a larger block with conditions for the value. It will take the value, and search for the first matching case among the conditions. It will then execute each line of code that follows, until it reaches the end of the block (the } ) or a break; command.
When nesting switches, just keep track of your braces {}, and treat each "level" as a separate entity (a break will only leave the current switch, not all of them) that is isolated from the others. For me, the best way of keeping track of each level and the braces, is to use proper indenting of the code, increasing the indent one step for each nested switch.

A generic, 4-level, switch would look somewhat like this
switch (value1)
{
  case 1:
    switch (value2)
    {
      case 1:
        switch (value3)
        {
          case 1:
            switch (value4)
            {
              case 1:
                some code here...
                break;
              case 2:
                other code here...
                break;
              default:
                code for value1:1, value2:1, value3:1, value4:other
            }
            break;
          case 2:
            switch (value4)
            {
              case 1:
                some code here...
                break;
              case 2:
                other code here...
                break;
              default:
                code for value1:1, value2:1, value3:2, value4:other
            }
            break;
          default:
            code for value1:1, value2:1, value3:other
        }
        break;
      case2:
        switch (value3)
        {
          case 1:
            switch (value4)
            {
              case 1:
                some code here...
                break;
              case 2:
                other code here...
                break;
              default:
                code for value1:1, value2:2, value3:1, value4:other
            }
            break;
          case 2:
            switch (value4)
            {
              case 1:
                some code here...
                break;
              case 2:
                other code here...
                break;
              default:
                code for value1:1, value2:2, value3:2, value4:other
            }
            break;
          default:
            code for value1:1, value2:2, value3:other
        }
        break;
      default:
        code for value1:1, value2:other
    }
    break;
  case 2:
    switch (value2)
    {
      case 1:
        switch (value3)
        {
          case 1:
            switch (value4)
            {
              case 1:
                some code here...
                break;
              case 2:
                other code here...
                break;
              default:
                code for value1:2, value2:1, value3:1, value4:other
            }
            break;
          case 2:
            switch (value4)
            {
              case 1:
                some code here...
                break;
              case 2:
                other code here...
                break;
              default:
                code for value1:2, value2:1, value3:2, value4:other
            }
            break;
          default:
            code for value1:2, value2:1, value3:other
        }
        break;
      case2:
        switch (value3)
        {
          case 1:
            switch (value4)
            {
              case 1:
                some code here...
                break;
              case 2:
                other code here...
                break;
              default:
                code for value1:2, value2:2, value3:1, value4:other
            }
            break;
          case 2:
            switch (value4)
            {
              case 1:
                some code here...
                break;
              case 2:
                other code here...
                break;
              default:
                code for value1:2, value2:2, value3:2, value4:other
            }
            break;
          default:
            code for value1:2, value2:2, value3:other
        }
        break;
      default:
        code for value1:2, value2:other
    }
    break;
  default:
    code for value1:other
}

As you can see, the complexity of these nested structures quickly becomes complex, so proper indenting is pretty much mandatory if you are to keep track of everything. Also, using an editor with syntax highlighting helps a lot; If you hav'nt tried it already, I highly recommend Notepad++.

/Fredrik
Ron 03 Oct, 2011
Hello Max,

Thanks for all the help I really appreciate it very much. I have made the code would you please go through and see if it is okay. There are only a few countries that I have to narrow down to the states most of the countries would just have a equipment and currency choice:

The code:
<?php
    $mainframe =& JFactory::getApplication();
    $country = JRequest::getString('country', '', 'post');
    $state = JRequest::getString('city_state', '', 'post');
    $equipment = JRequest::getString('equipment', '', 'post');
    $currency = JRequest::getString('currency', '', 'post');
	
    switch ($country)
    {
//=======================  starting common code for Indian States  ========================
      case 'India':
        switch ($state)
        {
             case 'Andaman and Nicobar Islands':
             case 'Andhra Pradesh':
             case 'Arunachal Pradesh':
             case 'Assam':
             case 'Bihar':
             case 'Chandigarh':
             case 'Chhattisgarh':
             case 'Dadra and Nagar Haveli':
             case 'Daman and Diu':
             case 'Delhi':
             case 'Goa':
             case 'Gujarat':
             case 'Haryana':
             case 'Jammu and Kashmir':
             case 'Jharkhand':
             case 'Karnataka':
             case 'Kerala':
             case 'Lakshadweep':
             case 'Madhya Pradesh':
             case 'Manipur':
             case 'Meghalaya':
             case 'Mizoram':
             case 'Nagaland':
             case 'Orissa':
             case 'Pondicherry':
             case 'Punjab':
             case 'Rajasthan':
             case 'Sikkim':
             case 'Tamil Nadu':
             case 'Tripura':
             case 'Uttarakhand':
             case 'Uttar Pradesh':
             case 'West Bengal':

        switch ($equipment)
        {
              case 'ESWL Model TMC-IA':
              switch ($currency)
              {
                  case 'Bahrain dinar(BHD).':
                  $url = 'bhd_en_torro';

                  case 'British pound(GBP).':
                  $url = 'gbp_en_torro';

                  case 'Europian EURO.':
                  $url = 'euro_en_torro';

                  case 'Saudi riyal(SAR).':
                  $url = 'sar_en_torro';

                  case 'US Dollars USD.':
                  $url = 'usd_en_torro';

                  case 'Ukrainian grivna(UAH).':
                  $url = 'uah_ru_torro';

                  case 'Indian Rupees(INR).':
                  $url = 'inr_en_torro';

                  case 'Philippine Peso(PhP).':
                  $url = 'peso_en_torro';
                  break;	

                 default:
                 //We don't know about this state, use region_unknown
                 $url = 'asia_quote';	
 
                 }
                 break;			
				 	 			   
             case 'ESWL Model TMC-SA':
             switch ($currency)
			 {
                case 'Bahrain dinar(BHD).':
                $url = 'bhd_en_eura';
                break;
				
                case 'British pound(GBP).':
                $url = 'gbp_en_eura';
                break;
				
                case 'Europian EURO.':
                $url = 'euro_en_eura';
                break;
				
                case 'Saudi riyal(SAR).':
                $url = 'sar_en_eura';
                break;
					
                case 'US Dollars USD.':
                $url = 'usd_en_eura';
                break;
				
                case 'Ukrainian grivna(UAH).':
                $url = 'uah_ru_eura';
                break;
					
                case 'Indian Rupees(INR).':
                $url = 'inr_en_eura';
                break;
				
                case 'Philippine Peso(PhP).':
                $url = 'peso_en_eura';
                break;
				
                default:
                //We don't know about this currency, use currency_default
                $url = 'asia_quote';
					
                }
                break;
				
            case 'ESWL Model - Compact':
            switch ($currency)
            {
               case 'Bahrain dinar(BHD).':
               $url = 'bhd_en_compact';
               break;
			   
               case 'British pound(GBP).':
               $url = 'gbp_en_compact';
               break;
			   
               case 'Europian EURO.':
               $url = 'euro_en_compact';
               break;
			   
               case 'Saudi riyal(SAR).':
               $url = 'sar_en_compact';
               break;	
			   
               case 'US Dollars USD.':
               $url = 'usd_en_compact';
               break;
			   
               case 'Ukrainian grivna(UAH).':
               $url = 'uah_ru_compact';
               break;	
			   
               case 'Indian Rupees(INR).':
               $url = 'inr_en_compact';
               break;
			   
               case 'Philippine Peso(PhP).':
               $url = 'peso_en_compact';
               break;	
			   					
             default:
                //We don't know about this currency, use currency_default
                $url = 'asia_quote';
					
                }
                break;

            case 'ESWL Model TMC-X4':
            switch ($currency)
            {
               case 'Bahrain dinar(BHD).':
               $url = 'bhd_en_x4';
               break;
			   
               case 'British pound(GBP).':
               $url = 'gbp_en_x4';
               break;
			   
               case 'Europian EURO.':
               $url = 'euro_en_x4';
               break;
			   
               case 'Saudi riyal(SAR).':
               $url = 'sar_en_x4';
               break;	
			   
               case 'US Dollars USD.':
               $url = 'usd_en_x4';
               break;
			   
               case 'Ukrainian grivna(UAH).':
               $url = 'uah_ru_x4';
               break;	
			   
               case 'Indian Rupees(INR).':
               $url = 'inr_en_x4';
               break;
			   
               case 'Philippine Peso(PhP).':
               $url = 'peso_en_x4';
               break;	
			   					
             default:
                //We don't know about this currency, use currency_default
                $url = 'asia_quote';
					
                }
                break;	
				
            case 'IECP Model SL-200':
            switch ($currency)
            {
               case 'Bahrain dinar(BHD).':
               $url = 'bhd_en_200';
               break;
			   
               case 'British pound(GBP).':
               $url = 'gbp_en_200';
               break;
			   
               case 'Europian EURO.':
               $url = 'euro_en_200';
               break;
			   
               case 'Saudi riyal(SAR).':
               $url = 'sar_en_200';
               break;	
			   
               case 'US Dollars USD.':
               $url = 'usd_en_200';
               break;
			   
               case 'Ukrainian grivna(UAH).':
               $url = 'uah_ru_200';
               break;	
			   
               case 'Indian Rupees(INR).':
               $url = 'inr_en_200';
               break;
			   
               case 'Philippine Peso(PhP).':
               $url = 'peso_en_200';
               break;	
			   					
             default:
                //We don't know about this currency, use currency_default
                $url = 'asia_quote';
					
                }
                break;	
				
            case 'IECP Model SL-200e':
            switch ($currency)
            {
               case 'Bahrain dinar(BHD).':
               $url = 'bhd_en_200e';
               break;
			   
               case 'British pound(GBP).':
               $url = 'gbp_en_200e';
               break;
			   
               case 'Europian EURO.':
               $url = 'euro_en_200e';
               break;
			   
               case 'Saudi riyal(SAR).':
               $url = 'sar_en_200e';
               break;	
			   
               case 'US Dollars USD.':
               $url = 'usd_en_200e';
               break;
			   
               case 'Ukrainian grivna(UAH).':
               $url = 'uah_ru_200e';
               break;	
			   
               case 'Indian Rupees(INR).':
               $url = 'inr_en_200e';
               break;
			   
               case 'Philippine Peso(PhP).':
               $url = 'peso_en_200e';
               break;	
			   					
             default:
                //We don't know about this currency, use currency_default
                $url = 'asia_quote';
					
                }
                break;
				
            case 'Ho.Laser TAE-40':
            switch ($currency)
            {
               case 'Bahrain dinar(BHD).':
               $url = 'bhd_en_40';
               break;
			   
               case 'British pound(GBP).':
               $url = 'gbp_en_40';
               break;
			   
               case 'Europian EURO.':
               $url = 'euro_en_40';
               break;
			   
               case 'Saudi riyal(SAR).':
               $url = 'sar_en_40';
               break;	
			   
               case 'US Dollars USD.':
               $url = 'usd_en_40';
               break;
			   
               case 'Ukrainian grivna(UAH).':
               $url = 'uah_ru_40';
               break;	
			   
               case 'Indian Rupees(INR).':
               $url = 'inr_en_40';
               break;
			   
               case 'Philippine Peso(PhP).':
               $url = 'peso_en_40';
               break;	
			   					
             default:
                //We don't know about this currency, use currency_default
                $url = 'asia_quote';
					
                }
                break;	
				
            case 'TCRT Equipment':
            switch ($currency)
            {
               case 'Bahrain dinar(BHD).':
               $url = 'comments';
               break;
			   
               case 'British pound(GBP).':
               $url = 'comments';
               break;
			   
               case 'Europian EURO.':
               $url = 'comments';
               break;
			   
               case 'Saudi riyal(SAR).':
               $url = 'comments';
               break;	
			   
               case 'US Dollars USD.':
               $url = 'comments';
               break;
			   
               case 'Ukrainian grivna(UAH).':
               $url = 'comments';
               break;	
			   
               case 'Indian Rupees(INR).':
               $url = 'comments';
               break;
			   
               case 'Philippine Peso(PhP).':
               $url = 'comments';
               break;	
			   					
             default:
                //We don't know about this currency, use currency_default
                $url = 'asia_quote';
					
                }
                break;																	

//==================  Ending common code for Indian States =========================

//    =====================  Starting sode for Himachal pradesh  ========================

        case 'Himachal Pradesh':
        switch ($equipment)
        {
              case 'ESWL Model TMC-IA':
              switch ($currency)
              {
                  case 'Bahrain dinar(BHD).':
                  $url = 'bhd_en_torro';

                  case 'British pound(GBP).':
                  $url = 'gbp_en_torro';

                  case 'Europian EURO.':
                  $url = 'euro_en_torro';

                  case 'Saudi riyal(SAR).':
                  $url = 'sar_en_torro';

                  case 'US Dollars USD.':
                  $url = 'usd_en_torro';

                  case 'Ukrainian grivna(UAH).':
                  $url = 'uah_ru_torro';

                  case 'Indian Rupees(INR).':
                  $url = 'hp_en_torro';

                  case 'Philippine Peso(PhP).':
                  $url = 'peso_en_torro';
                  break;	

                 default:
                 //We don't know about this state, use region_unknown
                 $url = 'asia_quote';	
 
                 }
                 break;			
				 	 			   
             case 'ESWL Model TMC-SA':
             switch ($currency)
			 {
                case 'Bahrain dinar(BHD).':
                $url = 'bhd_en_eura';
                break;
				
                case 'British pound(GBP).':
                $url = 'gbp_en_eura';
                break;
				
                case 'Europian EURO.':
                $url = 'euro_en_eura';
                break;
				
                case 'Saudi riyal(SAR).':
                $url = 'sar_en_eura';
                break;
					
                case 'US Dollars USD.':
                $url = 'usd_en_eura';
                break;
				
                case 'Ukrainian grivna(UAH).':
                $url = 'uah_ru_eura';
                break;
					
                case 'Indian Rupees(INR).':
                $url = 'hp_en_eura';
                break;
				
                case 'Philippine Peso(PhP).':
                $url = 'peso_en_eura';
                break;
				
                default:
                //We don't know about this currency, use currency_default
                $url = 'asia_quote';
					
                }
                break;
				
            case 'ESWL Model - Compact':
            switch ($currency)
            {
               case 'Bahrain dinar(BHD).':
               $url = 'bhd_en_compact';
               break;
			   
               case 'British pound(GBP).':
               $url = 'gbp_en_compact';
               break;
			   
               case 'Europian EURO.':
               $url = 'euro_en_compact';
               break;
			   
               case 'Saudi riyal(SAR).':
               $url = 'sar_en_compact';
               break;	
			   
               case 'US Dollars USD.':
               $url = 'usd_en_compact';
               break;
			   
               case 'Ukrainian grivna(UAH).':
               $url = 'uah_ru_compact';
               break;	
			   
               case 'Indian Rupees(INR).':
               $url = 'hp_en_compact';
               break;
			   
               case 'Philippine Peso(PhP).':
               $url = 'peso_en_compact';
               break;	
			   					
             default:
                //We don't know about this currency, use currency_default
                $url = 'asia_quote';
					
                }
                break;

            case 'ESWL Model TMC-X4':
            switch ($currency)
            {
               case 'Bahrain dinar(BHD).':
               $url = 'bhd_en_x4';
               break;
			   
               case 'British pound(GBP).':
               $url = 'gbp_en_x4';
               break;
			   
               case 'Europian EURO.':
               $url = 'euro_en_x4';
               break;
			   
               case 'Saudi riyal(SAR).':
               $url = 'sar_en_x4';
               break;	
			   
               case 'US Dollars USD.':
               $url = 'usd_en_x4';
               break;
			   
               case 'Ukrainian grivna(UAH).':
               $url = 'uah_ru_x4';
               break;	
			   
               case 'Indian Rupees(INR).':
               $url = 'hp_en_x4';
               break;
			   
               case 'Philippine Peso(PhP).':
               $url = 'peso_en_x4';
               break;	
			   					
             default:
                //We don't know about this currency, use currency_default
                $url = 'asia_quote';
					
                }
                break;	
				
            case 'IECP Model SL-200':
            switch ($currency)
            {
               case 'Bahrain dinar(BHD).':
               $url = 'bhd_en_200';
               break;
			   
               case 'British pound(GBP).':
               $url = 'gbp_en_200';
               break;
			   
               case 'Europian EURO.':
               $url = 'euro_en_200';
               break;
			   
               case 'Saudi riyal(SAR).':
               $url = 'sar_en_200';
               break;	
			   
               case 'US Dollars USD.':
               $url = 'usd_en_200';
               break;
			   
               case 'Ukrainian grivna(UAH).':
               $url = 'uah_ru_200';
               break;	
			   
               case 'Indian Rupees(INR).':
               $url = 'hp_en_200';
               break;
			   
               case 'Philippine Peso(PhP).':
               $url = 'peso_en_200';
               break;	
			   					
             default:
                //We don't know about this currency, use currency_default
                $url = 'asia_quote';
					
                }
                break;	
				
            case 'IECP Model SL-200e':
            switch ($currency)
            {
               case 'Bahrain dinar(BHD).':
               $url = 'bhd_en_200e';
               break;
			   
               case 'British pound(GBP).':
               $url = 'gbp_en_200e';
               break;
			   
               case 'Europian EURO.':
               $url = 'euro_en_200e';
               break;
			   
               case 'Saudi riyal(SAR).':
               $url = 'sar_en_200e';
               break;	
			   
               case 'US Dollars USD.':
               $url = 'usd_en_200e';
               break;
			   
               case 'Ukrainian grivna(UAH).':
               $url = 'uah_ru_200e';
               break;	
			   
               case 'Indian Rupees(INR).':
               $url = 'hp_en_200e';
               break;
			   
               case 'Philippine Peso(PhP).':
               $url = 'peso_en_200e';
               break;	
			   					
             default:
                //We don't know about this currency, use currency_default
                $url = 'asia_quote';
					
                }
                break;
				
            case 'Ho.Laser TAE-40':
            switch ($currency)
            {
               case 'Bahrain dinar(BHD).':
               $url = 'bhd_en_40';
               break;
			   
               case 'British pound(GBP).':
               $url = 'gbp_en_40';
               break;
			   
               case 'Europian EURO.':
               $url = 'euro_en_40';
               break;
			   
               case 'Saudi riyal(SAR).':
               $url = 'sar_en_40';
               break;	
			   
               case 'US Dollars USD.':
               $url = 'usd_en_40';
               break;
			   
               case 'Ukrainian grivna(UAH).':
               $url = 'uah_ru_40';
               break;	
			   
               case 'Indian Rupees(INR).':
               $url = 'hp_en_40';
               break;
			   
               case 'Philippine Peso(PhP).':
               $url = 'peso_en_40';
               break;	
			   					
             default:
                //We don't know about this currency, use currency_default
                $url = 'asia_quote';
					
                }
                break;	
				
            case 'TCRT Equipment':
            switch ($currency)
            {
               case 'Bahrain dinar(BHD).':
               $url = 'comments';
               break;
			   
               case 'British pound(GBP).':
               $url = 'comments';
               break;
			   
               case 'Europian EURO.':
               $url = 'comments';
               break;
			   
               case 'Saudi riyal(SAR).':
               $url = 'comments';
               break;	
			   
               case 'US Dollars USD.':
               $url = 'comments';
               break;
			   
               case 'Ukrainian grivna(UAH).':
               $url = 'comments';
               break;	
			   
               case 'Indian Rupees(INR).':
               $url = 'comments';
               break;
			   
               case 'Philippine Peso(PhP).':
               $url = 'comments';
               break;	
			   					
             default:
                //We don't know about this currency, use currency_default
                $url = 'asia_quote';
					
                }
                break;	
//    ============================== Ending Code for Himachal pradesh ==============================

//  ========================= STARTING CODE FOR MAHARASHTRA  ===================================


        case 'Maharashtra':
        switch ($equipment)
        {
              case 'ESWL Model TMC-IA':
              switch ($currency)
              {
                  case 'Bahrain dinar(BHD).':
                  $url = 'bhd_en_torro';

                  case 'British pound(GBP).':
                  $url = 'gbp_en_torro';

                  case 'Europian EURO.':
                  $url = 'euro_en_torro';

                  case 'Saudi riyal(SAR).':
                  $url = 'sar_en_torro';

                  case 'US Dollars USD.':
                  $url = 'usd_en_torro';

                  case 'Ukrainian grivna(UAH).':
                  $url = 'uah_ru_torro';

                  case 'Indian Rupees(INR).':
                  $url = 'maha_en_torro';

                  case 'Philippine Peso(PhP).':
                  $url = 'peso_en_torro';
                  break;	

                 default:
                 //We don't know about this state, use region_unknown
                 $url = 'asia_quote';	
 
                 }
                 break;			
				 	 			   
             case 'ESWL Model TMC-SA':
             switch ($currency)
			 {
                case 'Bahrain dinar(BHD).':
                $url = 'bhd_en_eura';
                break;
				
                case 'British pound(GBP).':
                $url = 'gbp_en_eura';
                break;
				
                case 'Europian EURO.':
                $url = 'euro_en_eura';
                break;
				
                case 'Saudi riyal(SAR).':
                $url = 'sar_en_eura';
                break;
					
                case 'US Dollars USD.':
                $url = 'usd_en_eura';
                break;
				
                case 'Ukrainian grivna(UAH).':
                $url = 'uah_ru_eura';
                break;
					
                case 'Indian Rupees(INR).':
                $url = 'maha_en_eura';
                break;
				
                case 'Philippine Peso(PhP).':
                $url = 'peso_en_eura';
                break;
				
                default:
                //We don't know about this currency, use currency_default
                $url = 'asia_quote';
					
                }
                break;
				
            case 'ESWL Model - Compact':
            switch ($currency)
            {
               case 'Bahrain dinar(BHD).':
               $url = 'bhd_en_compact';
               break;
			   
               case 'British pound(GBP).':
               $url = 'gbp_en_compact';
               break;
			   
               case 'Europian EURO.':
               $url = 'euro_en_compact';
               break;
			   
               case 'Saudi riyal(SAR).':
               $url = 'sar_en_compact';
               break;	
			   
               case 'US Dollars USD.':
               $url = 'usd_en_compact';
               break;
			   
               case 'Ukrainian grivna(UAH).':
               $url = 'uah_ru_compact';
               break;	
			   
               case 'Indian Rupees(INR).':
               $url = 'maha_en_compact';
               break;
			   
               case 'Philippine Peso(PhP).':
               $url = 'peso_en_compact';
               break;	
			   					
             default:
                //We don't know about this currency, use currency_default
                $url = 'asia_quote';
					
                }
                break;

            case 'ESWL Model TMC-X4':
            switch ($currency)
            {
               case 'Bahrain dinar(BHD).':
               $url = 'bhd_en_x4';
               break;
			   
               case 'British pound(GBP).':
               $url = 'gbp_en_x4';
               break;
			   
               case 'Europian EURO.':
               $url = 'euro_en_x4';
               break;
			   
               case 'Saudi riyal(SAR).':
               $url = 'sar_en_x4';
               break;	
			   
               case 'US Dollars USD.':
               $url = 'usd_en_x4';
               break;
			   
               case 'Ukrainian grivna(UAH).':
               $url = 'uah_ru_x4';
               break;	
			   
               case 'Indian Rupees(INR).':
               $url = 'maha_en_x4';
               break;
			   
               case 'Philippine Peso(PhP).':
               $url = 'peso_en_x4';
               break;	
			   					
             default:
                //We don't know about this currency, use currency_default
                $url = 'asia_quote';
					
                }
                break;	
				
            case 'IECP Model SL-200':
            switch ($currency)
            {
               case 'Bahrain dinar(BHD).':
               $url = 'bhd_en_200';
               break;
			   
               case 'British pound(GBP).':
               $url = 'gbp_en_200';
               break;
			   
               case 'Europian EURO.':
               $url = 'euro_en_200';
               break;
			   
               case 'Saudi riyal(SAR).':
               $url = 'sar_en_200';
               break;	
			   
               case 'US Dollars USD.':
               $url = 'usd_en_200';
               break;
			   
               case 'Ukrainian grivna(UAH).':
               $url = 'uah_ru_200';
               break;	
			   
               case 'Indian Rupees(INR).':
               $url = 'maha_en_200';
               break;
			   
               case 'Philippine Peso(PhP).':
               $url = 'peso_en_200';
               break;	
			   					
             default:
                //We don't know about this currency, use currency_default
                $url = 'asia_quote';
					
                }
                break;	
				
            case 'IECP Model SL-200e':
            switch ($currency)
            {
               case 'Bahrain dinar(BHD).':
               $url = 'bhd_en_200e';
               break;
			   
               case 'British pound(GBP).':
               $url = 'gbp_en_200e';
               break;
			   
               case 'Europian EURO.':
               $url = 'euro_en_200e';
               break;
			   
               case 'Saudi riyal(SAR).':
               $url = 'sar_en_200e';
               break;	
			   
               case 'US Dollars USD.':
               $url = 'usd_en_200e';
               break;
			   
               case 'Ukrainian grivna(UAH).':
               $url = 'uah_ru_200e';
               break;	
			   
               case 'Indian Rupees(INR).':
               $url = 'maha_en_200e';
               break;
			   
               case 'Philippine Peso(PhP).':
               $url = 'peso_en_200e';
               break;	
			   					
             default:
                //We don't know about this currency, use currency_default
                $url = 'asia_quote';
					
                }
                break;
				
            case 'Ho.Laser TAE-40':
            switch ($currency)
            {
               case 'Bahrain dinar(BHD).':
               $url = 'bhd_en_40';
               break;
			   
               case 'British pound(GBP).':
               $url = 'gbp_en_40';
               break;
			   
               case 'Europian EURO.':
               $url = 'euro_en_40';
               break;
			   
               case 'Saudi riyal(SAR).':
               $url = 'sar_en_40';
               break;	
			   
               case 'US Dollars USD.':
               $url = 'usd_en_40';
               break;
			   
               case 'Ukrainian grivna(UAH).':
               $url = 'uah_ru_40';
               break;	
			   
               case 'Indian Rupees(INR).':
               $url = 'maha_en_40';
               break;
			   
               case 'Philippine Peso(PhP).':
               $url = 'peso_en_40';
               break;	
			   					
             default:
                //We don't know about this currency, use currency_default
                $url = 'asia_quote';
					
                }
                break;	
				
            case 'TCRT Equipment':
            switch ($currency)
            {
               case 'Bahrain dinar(BHD).':
               $url = 'comments';
               break;
			   
               case 'British pound(GBP).':
               $url = 'comments';
               break;
			   
               case 'Europian EURO.':
               $url = 'comments';
               break;
			   
               case 'Saudi riyal(SAR).':
               $url = 'comments';
               break;	
			   
               case 'US Dollars USD.':
               $url = 'comments';
               break;
			   
               case 'Ukrainian grivna(UAH).':
               $url = 'comments';
               break;	
			   
               case 'Indian Rupees(INR).':
               $url = 'comments';
               break;
			   
               case 'Philippine Peso(PhP).':
               $url = 'comments';
               break;	
			   					
             default:
                //We don't know about this currency, use currency_default
                $url = 'asia_quote';
					
                }
                break;	
//    ============================== ENDING CODE FOR MAHARASHTRA ==============================

///  ===================================  STARTING COMMON CODE FOR COUNTRIES  =============================

      case 'United States':
      case 'Uruguay':
      case 'Uzbekistan':
      case 'Vanuatu':
      case 'Venezuela':
      case 'Vietnam':
      case 'Virgin Islands':
      case 'Wake Island':
      case 'Wallis and Futuna':
      case 'West Bank':
      case 'Western Sahara':
      case 'Yemen':
      case 'Zambia':
      case 'Zimbabwe':
	  
        switch ($equipment)
        {
              case 'ESWL Model TMC-IA':
              switch ($currency)
              {
                  case 'Bahrain dinar(BHD).':
                  $url = 'bhd_en_torro';

                  case 'British pound(GBP).':
                  $url = 'gbp_en_torro';

                  case 'Europian EURO.':
                  $url = 'euro_en_torro';

                  case 'Saudi riyal(SAR).':
                  $url = 'sar_en_torro';

                  case 'US Dollars USD.':
                  $url = 'usd_en_torro';

                  case 'Ukrainian grivna(UAH).':
                  $url = 'uah_ru_torro';

                  case 'Indian Rupees(INR).':
                  $url = 'inr_en_torro';

                  case 'Philippine Peso(PhP).':
                  $url = 'peso_en_torro';
                  break;	

                 default:
                 //We don't know about this state, use region_unknown
                 $url = 'asia_quote';	
 
                 }
                 break;			
				 	 			   
             case 'ESWL Model TMC-SA':
             switch ($currency)
			 {
                case 'Bahrain dinar(BHD).':
                $url = 'bhd_en_eura';
                break;
				
                case 'British pound(GBP).':
                $url = 'gbp_en_eura';
                break;
				
                case 'Europian EURO.':
                $url = 'euro_en_eura';
                break;
				
                case 'Saudi riyal(SAR).':
                $url = 'sar_en_eura';
                break;
					
                case 'US Dollars USD.':
                $url = 'usd_en_eura';
                break;
				
                case 'Ukrainian grivna(UAH).':
                $url = 'uah_ru_eura';
                break;
					
                case 'Indian Rupees(INR).':
                $url = 'inr_en_eura';
                break;
				
                case 'Philippine Peso(PhP).':
                $url = 'peso_en_eura';
                break;
				
                default:
                //We don't know about this currency, use currency_default
                $url = 'asia_quote';
					
                }
                break;
				
            case 'ESWL Model - Compact':
            switch ($currency)
            {
               case 'Bahrain dinar(BHD).':
               $url = 'bhd_en_compact';
               break;
			   
               case 'British pound(GBP).':
               $url = 'gbp_en_compact';
               break;
			   
               case 'Europian EURO.':
               $url = 'euro_en_compact';
               break;
			   
               case 'Saudi riyal(SAR).':
               $url = 'sar_en_compact';
               break;	
			   
               case 'US Dollars USD.':
               $url = 'usd_en_compact';
               break;
			   
               case 'Ukrainian grivna(UAH).':
               $url = 'uah_ru_compact';
               break;	
			   
               case 'Indian Rupees(INR).':
               $url = 'inr_en_compact';
               break;
			   
               case 'Philippine Peso(PhP).':
               $url = 'peso_en_compact';
               break;	
			   					
             default:
                //We don't know about this currency, use currency_default
                $url = 'asia_quote';
					
                }
                break;

            case 'ESWL Model TMC-X4':
            switch ($currency)
            {
               case 'Bahrain dinar(BHD).':
               $url = 'bhd_en_x4';
               break;
			   
               case 'British pound(GBP).':
               $url = 'gbp_en_x4';
               break;
			   
               case 'Europian EURO.':
               $url = 'euro_en_x4';
               break;
			   
               case 'Saudi riyal(SAR).':
               $url = 'sar_en_x4';
               break;	
			   
               case 'US Dollars USD.':
               $url = 'usd_en_x4';
               break;
			   
               case 'Ukrainian grivna(UAH).':
               $url = 'uah_ru_x4';
               break;	
			   
               case 'Indian Rupees(INR).':
               $url = 'inr_en_x4';
               break;
			   
               case 'Philippine Peso(PhP).':
               $url = 'peso_en_x4';
               break;	
			   					
             default:
                //We don't know about this currency, use currency_default
                $url = 'asia_quote';
					
                }
                break;	
				
            case 'IECP Model SL-200':
            switch ($currency)
            {
               case 'Bahrain dinar(BHD).':
               $url = 'bhd_en_200';
               break;
			   
               case 'British pound(GBP).':
               $url = 'gbp_en_200';
               break;
			   
               case 'Europian EURO.':
               $url = 'euro_en_200';
               break;
			   
               case 'Saudi riyal(SAR).':
               $url = 'sar_en_200';
               break;	
			   
               case 'US Dollars USD.':
               $url = 'usd_en_200';
               break;
			   
               case 'Ukrainian grivna(UAH).':
               $url = 'uah_ru_200';
               break;	
			   
               case 'Indian Rupees(INR).':
               $url = 'inr_en_200';
               break;
			   
               case 'Philippine Peso(PhP).':
               $url = 'peso_en_200';
               break;	
			   					
             default:
                //We don't know about this currency, use currency_default
                $url = 'asia_quote';
					
                }
                break;	
				
            case 'IECP Model SL-200e':
            switch ($currency)
            {
               case 'Bahrain dinar(BHD).':
               $url = 'bhd_en_200e';
               break;
			   
               case 'British pound(GBP).':
               $url = 'gbp_en_200e';
               break;
			   
               case 'Europian EURO.':
               $url = 'euro_en_200e';
               break;
			   
               case 'Saudi riyal(SAR).':
               $url = 'sar_en_200e';
               break;	
			   
               case 'US Dollars USD.':
               $url = 'usd_en_200e';
               break;
			   
               case 'Ukrainian grivna(UAH).':
               $url = 'uah_ru_200e';
               break;	
			   
               case 'Indian Rupees(INR).':
               $url = 'inr_en_200e';
               break;
			   
               case 'Philippine Peso(PhP).':
               $url = 'peso_en_200e';
               break;	
			   					
             default:
                //We don't know about this currency, use currency_default
                $url = 'asia_quote';
					
                }
                break;
				
            case 'Ho.Laser TAE-40':
            switch ($currency)
            {
               case 'Bahrain dinar(BHD).':
               $url = 'bhd_en_40';
               break;
			   
               case 'British pound(GBP).':
               $url = 'gbp_en_40';
               break;
			   
               case 'Europian EURO.':
               $url = 'euro_en_40';
               break;
			   
               case 'Saudi riyal(SAR).':
               $url = 'sar_en_40';
               break;	
			   
               case 'US Dollars USD.':
               $url = 'usd_en_40';
               break;
			   
               case 'Ukrainian grivna(UAH).':
               $url = 'uah_ru_40';
               break;	
			   
               case 'Indian Rupees(INR).':
               $url = 'inr_en_40';
               break;
			   
               case 'Philippine Peso(PhP).':
               $url = 'peso_en_40';
               break;	
			   					
             default:
                //We don't know about this currency, use currency_default
                $url = 'asia_quote';
					
                }
                break;	
				
            case 'TCRT Equipment':
            switch ($currency)
            {
               case 'Bahrain dinar(BHD).':
               $url = 'comments';
               break;
			   
               case 'British pound(GBP).':
               $url = 'comments';
               break;
			   
               case 'Europian EURO.':
               $url = 'comments';
               break;
			   
               case 'Saudi riyal(SAR).':
               $url = 'comments';
               break;	
			   
               case 'US Dollars USD.':
               $url = 'comments';
               break;
			   
               case 'Ukrainian grivna(UAH).':
               $url = 'comments';
               break;	
			   
               case 'Indian Rupees(INR).':
               $url = 'comments';
               break;
			   
               case 'Philippine Peso(PhP).':
               $url = 'comments';
               break;	
			   					
             default:
                //We don't know about this currency, use currency_default
                $url = 'asia_quote';
					
                }
                break;																	

////  ====================  END OF COMMON CODE FOR COUNTRIES  ============================
				
     }
 
    $url = '../test/index.php?option=com_chronoforms&chronoform=' . $url;
    $mainframe->redirect($url);
    ?> 


I would wait for your reply.

thanks and best wishes

Ron
nml375 03 Oct, 2011
Hi Ron,
There are some break;'s missing, and your braces are not properly balanced. This is where properly indenting the code helps a lot, as you get a sense of "depth" of the nested blocks.

Once corrected, the code should look somewhat like this:
<?php
$mainframe =& JFactory::getApplication();
$country = JRequest::getString('country', '', 'post');
$state = JRequest::getString('city_state', '', 'post');
$equipment = JRequest::getString('equipment', '', 'post');
$currency = JRequest::getString('currency', '', 'post');

switch ($country)
{
	//=======================  starting common code for Indian States  ========================
	case 'India':
		switch ($state)
		{
			case 'Andaman and Nicobar Islands':
			case 'Andhra Pradesh':
			case 'Arunachal Pradesh':
			case 'Assam':
			case 'Bihar':
			case 'Chandigarh':
			case 'Chhattisgarh':
			case 'Dadra and Nagar Haveli':
			case 'Daman and Diu':
			case 'Delhi':
			case 'Goa':
			case 'Gujarat':
			case 'Haryana':
			case 'Jammu and Kashmir':
			case 'Jharkhand':
			case 'Karnataka':
			case 'Kerala':
			case 'Lakshadweep':
			case 'Madhya Pradesh':
			case 'Manipur':
			case 'Meghalaya':
			case 'Mizoram':
			case 'Nagaland':
			case 'Orissa':
			case 'Pondicherry':
			case 'Punjab':
			case 'Rajasthan':
			case 'Sikkim':
			case 'Tamil Nadu':
			case 'Tripura':
			case 'Uttarakhand':
			case 'Uttar Pradesh':
			case 'West Bengal':

				switch ($equipment)
				{
					case 'ESWL Model TMC-IA':
						switch ($currency)
						{
							case 'Bahrain dinar(BHD).':
								$url = 'bhd_en_torro';
								break;

							case 'British pound(GBP).':
								$url = 'gbp_en_torro';
								break;

							case 'Europian EURO.':
								$url = 'euro_en_torro';
								break;

							case 'Saudi riyal(SAR).':
								$url = 'sar_en_torro';
								break;

							case 'US Dollars USD.':
								$url = 'usd_en_torro';
								break;

							case 'Ukrainian grivna(UAH).':
								$url = 'uah_ru_torro';
								break;

							case 'Indian Rupees(INR).':
								$url = 'inr_en_torro';
								break;

							case 'Philippine Peso(PhP).':
								$url = 'peso_en_torro';
								break;

							default:
								//We don't know about this state, use region_unknown
								$url = 'asia_quote';

						}
						break;
							
					case 'ESWL Model TMC-SA':
						switch ($currency)
						{
							case 'Bahrain dinar(BHD).':
								$url = 'bhd_en_eura';
								break;

							case 'British pound(GBP).':
								$url = 'gbp_en_eura';
								break;

							case 'Europian EURO.':
								$url = 'euro_en_eura';
								break;

							case 'Saudi riyal(SAR).':
								$url = 'sar_en_eura';
								break;
									
							case 'US Dollars USD.':
								$url = 'usd_en_eura';
								break;

							case 'Ukrainian grivna(UAH).':
								$url = 'uah_ru_eura';
								break;
									
							case 'Indian Rupees(INR).':
								$url = 'inr_en_eura';
								break;

							case 'Philippine Peso(PhP).':
								$url = 'peso_en_eura';
								break;

							default:
								//We don't know about this currency, use currency_default
								$url = 'asia_quote';
									
						}
						break;

					case 'ESWL Model - Compact':
						switch ($currency)
						{
							case 'Bahrain dinar(BHD).':
								$url = 'bhd_en_compact';
								break;

							case 'British pound(GBP).':
								$url = 'gbp_en_compact';
								break;

							case 'Europian EURO.':
								$url = 'euro_en_compact';
								break;

							case 'Saudi riyal(SAR).':
								$url = 'sar_en_compact';
								break;

							case 'US Dollars USD.':
								$url = 'usd_en_compact';
								break;

							case 'Ukrainian grivna(UAH).':
								$url = 'uah_ru_compact';
								break;

							case 'Indian Rupees(INR).':
								$url = 'inr_en_compact';
								break;

							case 'Philippine Peso(PhP).':
								$url = 'peso_en_compact';
								break;
									
							default:
								//We don't know about this currency, use currency_default
								$url = 'asia_quote';
									
						}
						break;

					case 'ESWL Model TMC-X4':
						switch ($currency)
						{
							case 'Bahrain dinar(BHD).':
								$url = 'bhd_en_x4';
								break;

							case 'British pound(GBP).':
								$url = 'gbp_en_x4';
								break;

							case 'Europian EURO.':
								$url = 'euro_en_x4';
								break;

							case 'Saudi riyal(SAR).':
								$url = 'sar_en_x4';
								break;

							case 'US Dollars USD.':
								$url = 'usd_en_x4';
								break;

							case 'Ukrainian grivna(UAH).':
								$url = 'uah_ru_x4';
								break;

							case 'Indian Rupees(INR).':
								$url = 'inr_en_x4';
								break;

							case 'Philippine Peso(PhP).':
								$url = 'peso_en_x4';
								break;
									
							default:
								//We don't know about this currency, use currency_default
								$url = 'asia_quote';
									
						}
						break;

					case 'IECP Model SL-200':
						switch ($currency)
						{
							case 'Bahrain dinar(BHD).':
								$url = 'bhd_en_200';
								break;

							case 'British pound(GBP).':
								$url = 'gbp_en_200';
								break;

							case 'Europian EURO.':
								$url = 'euro_en_200';
								break;

							case 'Saudi riyal(SAR).':
								$url = 'sar_en_200';
								break;

							case 'US Dollars USD.':
								$url = 'usd_en_200';
								break;

							case 'Ukrainian grivna(UAH).':
								$url = 'uah_ru_200';
								break;

							case 'Indian Rupees(INR).':
								$url = 'inr_en_200';
								break;

							case 'Philippine Peso(PhP).':
								$url = 'peso_en_200';
								break;
									
							default:
								//We don't know about this currency, use currency_default
								$url = 'asia_quote';
									
						}
						break;

					case 'IECP Model SL-200e':
						switch ($currency)
						{
							case 'Bahrain dinar(BHD).':
								$url = 'bhd_en_200e';
								break;

							case 'British pound(GBP).':
								$url = 'gbp_en_200e';
								break;

							case 'Europian EURO.':
								$url = 'euro_en_200e';
								break;

							case 'Saudi riyal(SAR).':
								$url = 'sar_en_200e';
								break;

							case 'US Dollars USD.':
								$url = 'usd_en_200e';
								break;

							case 'Ukrainian grivna(UAH).':
								$url = 'uah_ru_200e';
								break;

							case 'Indian Rupees(INR).':
								$url = 'inr_en_200e';
								break;

							case 'Philippine Peso(PhP).':
								$url = 'peso_en_200e';
								break;
									
							default:
								//We don't know about this currency, use currency_default
								$url = 'asia_quote';
									
						}
						break;

					case 'Ho.Laser TAE-40':
						switch ($currency)
						{
							case 'Bahrain dinar(BHD).':
								$url = 'bhd_en_40';
								break;

							case 'British pound(GBP).':
								$url = 'gbp_en_40';
								break;

							case 'Europian EURO.':
								$url = 'euro_en_40';
								break;

							case 'Saudi riyal(SAR).':
								$url = 'sar_en_40';
								break;

							case 'US Dollars USD.':
								$url = 'usd_en_40';
								break;

							case 'Ukrainian grivna(UAH).':
								$url = 'uah_ru_40';
								break;

							case 'Indian Rupees(INR).':
								$url = 'inr_en_40';
								break;

							case 'Philippine Peso(PhP).':
								$url = 'peso_en_40';
								break;
									
							default:
								//We don't know about this currency, use currency_default
								$url = 'asia_quote';
									
						}
						break;

					case 'TCRT Equipment':
						switch ($currency)
						{
							case 'Bahrain dinar(BHD).':
								$url = 'comments';
								break;

							case 'British pound(GBP).':
								$url = 'comments';
								break;

							case 'Europian EURO.':
								$url = 'comments';
								break;

							case 'Saudi riyal(SAR).':
								$url = 'comments';
								break;

							case 'US Dollars USD.':
								$url = 'comments';
								break;

							case 'Ukrainian grivna(UAH).':
								$url = 'comments';
								break;

							case 'Indian Rupees(INR).':
								$url = 'comments';
								break;

							case 'Philippine Peso(PhP).':
								$url = 'comments';
								break;
									
							default:
								//We don't know about this currency, use currency_default
								$url = 'asia_quote';
									
						}
						break;
				}
				break;

				//==================  Ending common code for Indian States =========================

				//    =====================  Starting sode for Himachal pradesh  ========================

			case 'Himachal Pradesh':
				switch ($equipment)
				{
					case 'ESWL Model TMC-IA':
						switch ($currency)
						{
							case 'Bahrain dinar(BHD).':
								$url = 'bhd_en_torro';
								break;

							case 'British pound(GBP).':
								$url = 'gbp_en_torro';
								break;

							case 'Europian EURO.':
								$url = 'euro_en_torro';
								break;

							case 'Saudi riyal(SAR).':
								$url = 'sar_en_torro';
								break;

							case 'US Dollars USD.':
								$url = 'usd_en_torro';
								break;

							case 'Ukrainian grivna(UAH).':
								$url = 'uah_ru_torro';
								break;

							case 'Indian Rupees(INR).':
								$url = 'hp_en_torro';
								break;

							case 'Philippine Peso(PhP).':
								$url = 'peso_en_torro';
								break;

							default:
								//We don't know about this state, use region_unknown
								$url = 'asia_quote';

						}
						break;
							
					case 'ESWL Model TMC-SA':
						switch ($currency)
						{
							case 'Bahrain dinar(BHD).':
								$url = 'bhd_en_eura';
								break;

							case 'British pound(GBP).':
								$url = 'gbp_en_eura';
								break;

							case 'Europian EURO.':
								$url = 'euro_en_eura';
								break;

							case 'Saudi riyal(SAR).':
								$url = 'sar_en_eura';
								break;
									
							case 'US Dollars USD.':
								$url = 'usd_en_eura';
								break;

							case 'Ukrainian grivna(UAH).':
								$url = 'uah_ru_eura';
								break;
									
							case 'Indian Rupees(INR).':
								$url = 'hp_en_eura';
								break;

							case 'Philippine Peso(PhP).':
								$url = 'peso_en_eura';
								break;

							default:
								//We don't know about this currency, use currency_default
								$url = 'asia_quote';
									
						}
						break;

					case 'ESWL Model - Compact':
						switch ($currency)
						{
							case 'Bahrain dinar(BHD).':
								$url = 'bhd_en_compact';
								break;

							case 'British pound(GBP).':
								$url = 'gbp_en_compact';
								break;

							case 'Europian EURO.':
								$url = 'euro_en_compact';
								break;

							case 'Saudi riyal(SAR).':
								$url = 'sar_en_compact';
								break;

							case 'US Dollars USD.':
								$url = 'usd_en_compact';
								break;

							case 'Ukrainian grivna(UAH).':
								$url = 'uah_ru_compact';
								break;

							case 'Indian Rupees(INR).':
								$url = 'hp_en_compact';
								break;

							case 'Philippine Peso(PhP).':
								$url = 'peso_en_compact';
								break;
									
							default:
								//We don't know about this currency, use currency_default
								$url = 'asia_quote';
									
						}
						break;

					case 'ESWL Model TMC-X4':
						switch ($currency)
						{
							case 'Bahrain dinar(BHD).':
								$url = 'bhd_en_x4';
								break;

							case 'British pound(GBP).':
								$url = 'gbp_en_x4';
								break;

							case 'Europian EURO.':
								$url = 'euro_en_x4';
								break;

							case 'Saudi riyal(SAR).':
								$url = 'sar_en_x4';
								break;

							case 'US Dollars USD.':
								$url = 'usd_en_x4';
								break;

							case 'Ukrainian grivna(UAH).':
								$url = 'uah_ru_x4';
								break;

							case 'Indian Rupees(INR).':
								$url = 'hp_en_x4';
								break;

							case 'Philippine Peso(PhP).':
								$url = 'peso_en_x4';
								break;
									
							default:
								//We don't know about this currency, use currency_default
								$url = 'asia_quote';
									
						}
						break;

					case 'IECP Model SL-200':
						switch ($currency)
						{
							case 'Bahrain dinar(BHD).':
								$url = 'bhd_en_200';
								break;

							case 'British pound(GBP).':
								$url = 'gbp_en_200';
								break;

							case 'Europian EURO.':
								$url = 'euro_en_200';
								break;

							case 'Saudi riyal(SAR).':
								$url = 'sar_en_200';
								break;

							case 'US Dollars USD.':
								$url = 'usd_en_200';
								break;

							case 'Ukrainian grivna(UAH).':
								$url = 'uah_ru_200';
								break;

							case 'Indian Rupees(INR).':
								$url = 'hp_en_200';
								break;

							case 'Philippine Peso(PhP).':
								$url = 'peso_en_200';
								break;
									
							default:
								//We don't know about this currency, use currency_default
								$url = 'asia_quote';
									
						}
						break;

					case 'IECP Model SL-200e':
						switch ($currency)
						{
							case 'Bahrain dinar(BHD).':
								$url = 'bhd_en_200e';
								break;

							case 'British pound(GBP).':
								$url = 'gbp_en_200e';
								break;

							case 'Europian EURO.':
								$url = 'euro_en_200e';
								break;

							case 'Saudi riyal(SAR).':
								$url = 'sar_en_200e';
								break;

							case 'US Dollars USD.':
								$url = 'usd_en_200e';
								break;

							case 'Ukrainian grivna(UAH).':
								$url = 'uah_ru_200e';
								break;

							case 'Indian Rupees(INR).':
								$url = 'hp_en_200e';
								break;

							case 'Philippine Peso(PhP).':
								$url = 'peso_en_200e';
								break;
									
							default:
								//We don't know about this currency, use currency_default
								$url = 'asia_quote';
									
						}
						break;

					case 'Ho.Laser TAE-40':
						switch ($currency)
						{
							case 'Bahrain dinar(BHD).':
								$url = 'bhd_en_40';
								break;

							case 'British pound(GBP).':
								$url = 'gbp_en_40';
								break;

							case 'Europian EURO.':
								$url = 'euro_en_40';
								break;

							case 'Saudi riyal(SAR).':
								$url = 'sar_en_40';
								break;

							case 'US Dollars USD.':
								$url = 'usd_en_40';
								break;

							case 'Ukrainian grivna(UAH).':
								$url = 'uah_ru_40';
								break;

							case 'Indian Rupees(INR).':
								$url = 'hp_en_40';
								break;

							case 'Philippine Peso(PhP).':
								$url = 'peso_en_40';
								break;
									
							default:
								//We don't know about this currency, use currency_default
								$url = 'asia_quote';
									
						}
						break;

					case 'TCRT Equipment':
						switch ($currency)
						{
							case 'Bahrain dinar(BHD).':
								$url = 'comments';
								break;

							case 'British pound(GBP).':
								$url = 'comments';
								break;

							case 'Europian EURO.':
								$url = 'comments';
								break;

							case 'Saudi riyal(SAR).':
								$url = 'comments';
								break;

							case 'US Dollars USD.':
								$url = 'comments';
								break;

							case 'Ukrainian grivna(UAH).':
								$url = 'comments';
								break;

							case 'Indian Rupees(INR).':
								$url = 'comments';
								break;

							case 'Philippine Peso(PhP).':
								$url = 'comments';
								break;
									
							default:
								//We don't know about this currency, use currency_default
								$url = 'asia_quote';
									
						}
						break;
						//    ============================== Ending Code for Himachal pradesh ==============================
				}
				break;
				//  ========================= STARTING CODE FOR MAHARASHTRA  ===================================


			case 'Maharashtra':
				switch ($equipment)
				{
					case 'ESWL Model TMC-IA':
						switch ($currency)
						{
							case 'Bahrain dinar(BHD).':
								$url = 'bhd_en_torro';
								break;

							case 'British pound(GBP).':
								$url = 'gbp_en_torro';
								break;

							case 'Europian EURO.':
								$url = 'euro_en_torro';
								break;

							case 'Saudi riyal(SAR).':
								$url = 'sar_en_torro';
								break;

							case 'US Dollars USD.':
								$url = 'usd_en_torro';
								break;

							case 'Ukrainian grivna(UAH).':
								$url = 'uah_ru_torro';
								break;

							case 'Indian Rupees(INR).':
								$url = 'maha_en_torro';
								break;

							case 'Philippine Peso(PhP).':
								$url = 'peso_en_torro';
								break;

							default:
								//We don't know about this state, use region_unknown
								$url = 'asia_quote';

						}
						break;
							
					case 'ESWL Model TMC-SA':
						switch ($currency)
						{
							case 'Bahrain dinar(BHD).':
								$url = 'bhd_en_eura';
								break;

							case 'British pound(GBP).':
								$url = 'gbp_en_eura';
								break;

							case 'Europian EURO.':
								$url = 'euro_en_eura';
								break;

							case 'Saudi riyal(SAR).':
								$url = 'sar_en_eura';
								break;
									
							case 'US Dollars USD.':
								$url = 'usd_en_eura';
								break;

							case 'Ukrainian grivna(UAH).':
								$url = 'uah_ru_eura';
								break;
									
							case 'Indian Rupees(INR).':
								$url = 'maha_en_eura';
								break;

							case 'Philippine Peso(PhP).':
								$url = 'peso_en_eura';
								break;

							default:
								//We don't know about this currency, use currency_default
								$url = 'asia_quote';
									
						}
						break;

					case 'ESWL Model - Compact':
						switch ($currency)
						{
							case 'Bahrain dinar(BHD).':
								$url = 'bhd_en_compact';
								break;

							case 'British pound(GBP).':
								$url = 'gbp_en_compact';
								break;

							case 'Europian EURO.':
								$url = 'euro_en_compact';
								break;

							case 'Saudi riyal(SAR).':
								$url = 'sar_en_compact';
								break;

							case 'US Dollars USD.':
								$url = 'usd_en_compact';
								break;

							case 'Ukrainian grivna(UAH).':
								$url = 'uah_ru_compact';
								break;

							case 'Indian Rupees(INR).':
								$url = 'maha_en_compact';
								break;

							case 'Philippine Peso(PhP).':
								$url = 'peso_en_compact';
								break;
									
							default:
								//We don't know about this currency, use currency_default
								$url = 'asia_quote';
									
						}
						break;

					case 'ESWL Model TMC-X4':
						switch ($currency)
						{
							case 'Bahrain dinar(BHD).':
								$url = 'bhd_en_x4';
								break;

							case 'British pound(GBP).':
								$url = 'gbp_en_x4';
								break;

							case 'Europian EURO.':
								$url = 'euro_en_x4';
								break;

							case 'Saudi riyal(SAR).':
								$url = 'sar_en_x4';
								break;

							case 'US Dollars USD.':
								$url = 'usd_en_x4';
								break;

							case 'Ukrainian grivna(UAH).':
								$url = 'uah_ru_x4';
								break;

							case 'Indian Rupees(INR).':
								$url = 'maha_en_x4';
								break;

							case 'Philippine Peso(PhP).':
								$url = 'peso_en_x4';
								break;
									
							default:
								//We don't know about this currency, use currency_default
								$url = 'asia_quote';
									
						}
						break;

					case 'IECP Model SL-200':
						switch ($currency)
						{
							case 'Bahrain dinar(BHD).':
								$url = 'bhd_en_200';
								break;

							case 'British pound(GBP).':
								$url = 'gbp_en_200';
								break;

							case 'Europian EURO.':
								$url = 'euro_en_200';
								break;

							case 'Saudi riyal(SAR).':
								$url = 'sar_en_200';
								break;

							case 'US Dollars USD.':
								$url = 'usd_en_200';
								break;

							case 'Ukrainian grivna(UAH).':
								$url = 'uah_ru_200';
								break;

							case 'Indian Rupees(INR).':
								$url = 'maha_en_200';
								break;

							case 'Philippine Peso(PhP).':
								$url = 'peso_en_200';
								break;
									
							default:
								//We don't know about this currency, use currency_default
								$url = 'asia_quote';
									
						}
						break;

					case 'IECP Model SL-200e':
						switch ($currency)
						{
							case 'Bahrain dinar(BHD).':
								$url = 'bhd_en_200e';
								break;

							case 'British pound(GBP).':
								$url = 'gbp_en_200e';
								break;

							case 'Europian EURO.':
								$url = 'euro_en_200e';
								break;

							case 'Saudi riyal(SAR).':
								$url = 'sar_en_200e';
								break;

							case 'US Dollars USD.':
								$url = 'usd_en_200e';
								break;

							case 'Ukrainian grivna(UAH).':
								$url = 'uah_ru_200e';
								break;

							case 'Indian Rupees(INR).':
								$url = 'maha_en_200e';
								break;

							case 'Philippine Peso(PhP).':
								$url = 'peso_en_200e';
								break;
									
							default:
								//We don't know about this currency, use currency_default
								$url = 'asia_quote';
									
						}
						break;

					case 'Ho.Laser TAE-40':
						switch ($currency)
						{
							case 'Bahrain dinar(BHD).':
								$url = 'bhd_en_40';
								break;

							case 'British pound(GBP).':
								$url = 'gbp_en_40';
								break;

							case 'Europian EURO.':
								$url = 'euro_en_40';
								break;

							case 'Saudi riyal(SAR).':
								$url = 'sar_en_40';
								break;

							case 'US Dollars USD.':
								$url = 'usd_en_40';
								break;

							case 'Ukrainian grivna(UAH).':
								$url = 'uah_ru_40';
								break;

							case 'Indian Rupees(INR).':
								$url = 'maha_en_40';
								break;

							case 'Philippine Peso(PhP).':
								$url = 'peso_en_40';
								break;
									
							default:
								//We don't know about this currency, use currency_default
								$url = 'asia_quote';
									
						}
						break;

					case 'TCRT Equipment':
						switch ($currency)
						{
							case 'Bahrain dinar(BHD).':
								$url = 'comments';
								break;

							case 'British pound(GBP).':
								$url = 'comments';
								break;

							case 'Europian EURO.':
								$url = 'comments';
								break;

							case 'Saudi riyal(SAR).':
								$url = 'comments';
								break;

							case 'US Dollars USD.':
								$url = 'comments';
								break;

							case 'Ukrainian grivna(UAH).':
								$url = 'comments';
								break;

							case 'Indian Rupees(INR).':
								$url = 'comments';
								break;

							case 'Philippine Peso(PhP).':
								$url = 'comments';
								break;
									
							default:
								//We don't know about this currency, use currency_default
								$url = 'asia_quote';
									
						}
						break;
				}
				break;
		}
		break;

		//    ============================== ENDING CODE FOR MAHARASHTRA ==============================

		///  ===================================  STARTING COMMON CODE FOR COUNTRIES  =============================

	case 'United States':
	case 'Uruguay':
	case 'Uzbekistan':
	case 'Vanuatu':
	case 'Venezuela':
	case 'Vietnam':
	case 'Virgin Islands':
	case 'Wake Island':
	case 'Wallis and Futuna':
	case 'West Bank':
	case 'Western Sahara':
	case 'Yemen':
	case 'Zambia':
	case 'Zimbabwe':

		switch ($equipment)
		{
			case 'ESWL Model TMC-IA':
				switch ($currency)
				{
					case 'Bahrain dinar(BHD).':
						$url = 'bhd_en_torro';
						break;

					case 'British pound(GBP).':
						$url = 'gbp_en_torro';
						break;

					case 'Europian EURO.':
						$url = 'euro_en_torro';
						break;

					case 'Saudi riyal(SAR).':
						$url = 'sar_en_torro';
						break;

					case 'US Dollars USD.':
						$url = 'usd_en_torro';
						break;

					case 'Ukrainian grivna(UAH).':
						$url = 'uah_ru_torro';
						break;

					case 'Indian Rupees(INR).':
						$url = 'inr_en_torro';
						break;

					case 'Philippine Peso(PhP).':
						$url = 'peso_en_torro';
						break;

					default:
						//We don't know about this state, use region_unknown
						$url = 'asia_quote';

				}
				break;
					
			case 'ESWL Model TMC-SA':
				switch ($currency)
				{
					case 'Bahrain dinar(BHD).':
						$url = 'bhd_en_eura';
						break;

					case 'British pound(GBP).':
						$url = 'gbp_en_eura';
						break;

					case 'Europian EURO.':
						$url = 'euro_en_eura';
						break;

					case 'Saudi riyal(SAR).':
						$url = 'sar_en_eura';
						break;
							
					case 'US Dollars USD.':
						$url = 'usd_en_eura';
						break;

					case 'Ukrainian grivna(UAH).':
						$url = 'uah_ru_eura';
						break;
							
					case 'Indian Rupees(INR).':
						$url = 'inr_en_eura';
						break;

					case 'Philippine Peso(PhP).':
						$url = 'peso_en_eura';
						break;

					default:
						//We don't know about this currency, use currency_default
						$url = 'asia_quote';
							
				}
				break;

			case 'ESWL Model - Compact':
				switch ($currency)
				{
					case 'Bahrain dinar(BHD).':
						$url = 'bhd_en_compact';
						break;

					case 'British pound(GBP).':
						$url = 'gbp_en_compact';
						break;

					case 'Europian EURO.':
						$url = 'euro_en_compact';
						break;

					case 'Saudi riyal(SAR).':
						$url = 'sar_en_compact';
						break;

					case 'US Dollars USD.':
						$url = 'usd_en_compact';
						break;

					case 'Ukrainian grivna(UAH).':
						$url = 'uah_ru_compact';
						break;

					case 'Indian Rupees(INR).':
						$url = 'inr_en_compact';
						break;

					case 'Philippine Peso(PhP).':
						$url = 'peso_en_compact';
						break;
							
					default:
						//We don't know about this currency, use currency_default
						$url = 'asia_quote';
							
				}
				break;

			case 'ESWL Model TMC-X4':
				switch ($currency)
				{
					case 'Bahrain dinar(BHD).':
						$url = 'bhd_en_x4';
						break;

					case 'British pound(GBP).':
						$url = 'gbp_en_x4';
						break;

					case 'Europian EURO.':
						$url = 'euro_en_x4';
						break;

					case 'Saudi riyal(SAR).':
						$url = 'sar_en_x4';
						break;

					case 'US Dollars USD.':
						$url = 'usd_en_x4';
						break;

					case 'Ukrainian grivna(UAH).':
						$url = 'uah_ru_x4';
						break;

					case 'Indian Rupees(INR).':
						$url = 'inr_en_x4';
						break;

					case 'Philippine Peso(PhP).':
						$url = 'peso_en_x4';
						break;
							
					default:
						//We don't know about this currency, use currency_default
						$url = 'asia_quote';
							
				}
				break;

			case 'IECP Model SL-200':
				switch ($currency)
				{
					case 'Bahrain dinar(BHD).':
						$url = 'bhd_en_200';
						break;

					case 'British pound(GBP).':
						$url = 'gbp_en_200';
						break;

					case 'Europian EURO.':
						$url = 'euro_en_200';
						break;

					case 'Saudi riyal(SAR).':
						$url = 'sar_en_200';
						break;

					case 'US Dollars USD.':
						$url = 'usd_en_200';
						break;

					case 'Ukrainian grivna(UAH).':
						$url = 'uah_ru_200';
						break;

					case 'Indian Rupees(INR).':
						$url = 'inr_en_200';
						break;

					case 'Philippine Peso(PhP).':
						$url = 'peso_en_200';
						break;
							
					default:
						//We don't know about this currency, use currency_default
						$url = 'asia_quote';
							
				}
				break;

			case 'IECP Model SL-200e':
				switch ($currency)
				{
					case 'Bahrain dinar(BHD).':
						$url = 'bhd_en_200e';
						break;

					case 'British pound(GBP).':
						$url = 'gbp_en_200e';
						break;

					case 'Europian EURO.':
						$url = 'euro_en_200e';
						break;

					case 'Saudi riyal(SAR).':
						$url = 'sar_en_200e';
						break;

					case 'US Dollars USD.':
						$url = 'usd_en_200e';
						break;

					case 'Ukrainian grivna(UAH).':
						$url = 'uah_ru_200e';
						break;

					case 'Indian Rupees(INR).':
						$url = 'inr_en_200e';
						break;

					case 'Philippine Peso(PhP).':
						$url = 'peso_en_200e';
						break;
							
					default:
						//We don't know about this currency, use currency_default
						$url = 'asia_quote';
							
				}
				break;

			case 'Ho.Laser TAE-40':
				switch ($currency)
				{
					case 'Bahrain dinar(BHD).':
						$url = 'bhd_en_40';
						break;

					case 'British pound(GBP).':
						$url = 'gbp_en_40';
						break;

					case 'Europian EURO.':
						$url = 'euro_en_40';
						break;

					case 'Saudi riyal(SAR).':
						$url = 'sar_en_40';
						break;

					case 'US Dollars USD.':
						$url = 'usd_en_40';
						break;

					case 'Ukrainian grivna(UAH).':
						$url = 'uah_ru_40';
						break;

					case 'Indian Rupees(INR).':
						$url = 'inr_en_40';
						break;

					case 'Philippine Peso(PhP).':
						$url = 'peso_en_40';
						break;
							
					default:
						//We don't know about this currency, use currency_default
						$url = 'asia_quote';
							
				}
				break;

			case 'TCRT Equipment':
				switch ($currency)
				{
					case 'Bahrain dinar(BHD).':
						$url = 'comments';
						break;

					case 'British pound(GBP).':
						$url = 'comments';
						break;

					case 'Europian EURO.':
						$url = 'comments';
						break;

					case 'Saudi riyal(SAR).':
						$url = 'comments';
						break;

					case 'US Dollars USD.':
						$url = 'comments';
						break;

					case 'Ukrainian grivna(UAH).':
						$url = 'comments';
						break;

					case 'Indian Rupees(INR).':
						$url = 'comments';
						break;

					case 'Philippine Peso(PhP).':
						$url = 'comments';
						break;
							
					default:
						//We don't know about this currency, use currency_default
						$url = 'asia_quote';
							
				}
				break;

				////  ====================  END OF COMMON CODE FOR COUNTRIES  ============================

		}
		break;
}

$url = '../test/index.php?option=com_chronoforms&chronoform=' . $url;
$mainframe->redirect($url);
?>


/Fredrik
Ron 03 Oct, 2011
Hello Fredrik,

I am going to try this code. Hope it works.

Thank you very much.😀

Ron
Ron 03 Oct, 2011
Thanks Fredrik,

I must say you are quite a guy 😀 . This thing just works fantastic this I feel is the first code I made myself with your help. I feel proud of myself too. I feel I must leave medicine and become a code specialist😀 .

Thanks a thousand times. Hope to meet you one day.

Bye the way is it normal to get a blank page with a small message on the top left corner which says "Form name can NOT be empty!" if a form for that address is not existing ?

Thanks

Ron
Ron 16 Oct, 2011
Hello Fredrik

There is one more information I required about this redirection code.

                
                 <tr>
				  <td width="210" align="left" valign="middle" class="">Select the Download:</td>
					<td>    <select id='downloads' name='downloads' type="text" class=" validate['required']" style='width:250px;' onChange='change_downloads();' >
                        <option value='Select an Equipment' selected='selected' >Select a Download</option>
                        <option value='catalog - 1'>catalog - 1</option>
                        <option value='catalog - 2'>catalog - 2</option>
                        <option value='catalog - 3'>catalog - 3</option>
                        <option value='catalog - 4'>catalog - 4</option>             
                     </select>
                    </td>  

How do I send a reply "REPLY X" to a person if he chooses from the drop down list say catalog - 2 and "REPLY -Y" to a person if he chooses catalog -3 and so on.

I do not want a visitor getting a download link instead I want a catalog to be sent as an attachment to his email.

Please help

Ron
Ron 19 Oct, 2011
Thanks for the reply Fredrik,

I am using these on CFv4 on a test site yet. And also going through the thread you mentioned I could hardly understanding anything. It was rather confusing for me.

Could you please be considering me as a dummy.

Thanks

Ron
nml375 19 Oct, 2011
Hi Ron,
The v3 code will not work with v4. I'm not that familiar with v4, though I've done some digging in the source..

You'll need a custom code action (prior the email action) with a code similar to this:
switch ($_POST['downloads'])
{
  case 'catalog - 1':
    $form->files['catalog'] = array(
      'path' => '/path/to/catalog1.pdf'
    );
    break;
  case 'catalog - 2':
    $form->files['catalog'] = array(
      'path' => '/path/to/catalog2.pdf'
    );
    break;
}

You'll need one case for each option in the drop-down.
You'll also have to include an attachment field name named "catalog" in your email action.

/Fredrik
Ron 20 Oct, 2011
Thanks for the code Fredrik,

But as I see this redirection code will open the relevant catalog.pdf file. I do not want it to open any file but the catalog should go as an attachment with the thanks reply email.
For attachment I intend to use this code: Ofcourse I will have to work on this code too.

<?php
$MyForm =& CFChronoForm::getInstance('Your_Form_Name');//Replace with Your Form name
$form_id = $MyForm->formrow->id;
$MyUploads =& CFUploads::getInstance($form_id);
$MyUploads->attachments [] = '/home/domain/public_html/images/stories/cat/your_file';
?>


Thanks for all the help.

Ron
nml375 20 Oct, 2011
Hi Ron,
That code will only work with v3. The code I posted should be the equivalent for v4, there is no redirect-code in there.

/Fredrik
This topic is locked and no more replies can be posted.