CalcBuilder Forum

Money Converter

Usuario bigmediaexpert 2015-11-04 11:12:29

Hi Moonsoft,

I am trying to do a calculator that user input his amount of money and choose the 2 currencies to calculate
his amount for example: I want to convert MY AMOUNT OF 10000 (textfield) FROM euro (dropdown ) TO dollar (dropdown )! This is one piece of the code:

If (var1==eu && var2==do){

$result=$sum*1.096;
}
else If (var1==eu && var2==eu){

$result=$sum*1;
}
else If (var1==eu && var2==le){

$result=$sum*1.389;
}
else If (var1==eu && var2==pa){

$result=$sum*0.710;
}
The result don't show in the frontend after i click calculate!

Please help 'cause it's urgent!
Thank you in Advance!

Edited by bigmediaexpert - 04.11.2015 11:27

Moonsoft support 2015-11-04 11:20:44

Hi,
we assume your first dropdown has variable name 'var1', the second has variable name 'var2', the amount textfield has variable name 'sum'
and the values of the dropdowns are 'eu' 'do' and 'pa', right?

Then you only need to correct a few sintax errors at your code.

if ($var1=="eu" && $var2=="do"){

$result=.....
}
same for the other 'if' expressions. then you can print ##result## at your output section. The corrections:


- if must be written in lowercase
- all variables must be preceeded by dollar sign $
- values enclosed inside " because they are not numbers but texts.



As soon as you enter an error at your code you won't get right response, we suggest to enter one if block and once you have it working add the other combinations.


Hope this helps,regards

Usuario bigmediaexpert 2015-11-06 11:26:09

Thank you very much! I did it!

I have another question!

How can I change the up limit of a text area when i choose a value from a dropdown list?

Moonsoft support 2015-11-09 13:10:19

Hi,

We are not sure of the function required. Are you looking for a method to force a numeric limit or do you want to limit the maximun number of characters of the textarea?

Regards,

Usuario bigmediaexpert 2015-11-13 10:30:05

I want to do a loan calculator like the demo version but my exit results don't show the table of amortization! It shows all the results in a row , not in the table! And the javascript function drawchart() doesn't show the chart! it draws an empty chart!

Can you please check it what's wrong?!

http://46.101.225.81/ak-invest/index.php/kredi-mbi-llogarine-e-arketueshme

Thank you in advance

Moonsoft support 2015-11-13 15:37:34

Hi,
it's hard to tell only seeing the frontend result. We assume you have copied the calculator from the demo site and used as template for building your own? If so, please double check you have copied the js from all javascript tabs, and also the exit layout containing same sections from the example (you can use toggle editor to copy the exact html).

If you can't get it working, please export your calculator abd attach it zipped to a private ticket of your helpdesk, we'll try it here and let you know which is the configuration missing.

Regards

Usuario bigmediaexpert 2015-12-04 15:25:44

I have copied all the script from javascript tabs, from exit layout, from php code with toggle editor and the results are the same! How can i export my calculator?! I have to zipped the calcbuilder folder at the server or what?

Thank you for the support !

Moonsoft support 2015-12-04 17:47:37

Hi,
in order to export a calculator you must use the 'save' icon you will find next to your calculator name at the calcbuilder list of calculators page. This will create the xml file with all the information that you can zip.

Regards

Usuario bigmediaexpert 2015-12-24 18:49:44

Hi again,

Is any way to include an external php file and to show external variables as calcbuilder results!

For example i want to:

include "script/example.php"

and to show $myresult = $var1 (from example.php) * 12.03 / $var2 -5.7;

Is this possible?! Please i need help!

Thank you in advance!

Edited by bigmediaexpert - 24.12.2015 18:50

Edited by bigmediaexpert - 24.12.2015 18:51

Moonsoft support 2015-12-27 09:37:22

Hi
Yes,you can use any valid php expression at your code section. This works for includes require ,require_once... php functions that you can use to include external php files inside your calculator code

Regards

...
Support/development

Perfect for small code changes or to correct any bug at your site

Buy now!
...
List Manager

Build different lists for your site

Buy now!