PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
joecrack
Forum Commoner
Posts: 99 Joined: Mon Oct 31, 2005 9:17 pm
Post
by joecrack » Mon Oct 31, 2005 9:29 pm
Hi
i tried to write a script wich calculates dollar, euro, yen, pes to chinese YUAN. Working
But then i tried to add checkbox that calculates the MWST its "added value tax" - not working!
Code: Select all
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>Euro-Rechner</title></head>
<body>
<center>
<?php
$ergebnisDollar = $betrag*8.29;
$ergebnisEuro = $betrag*10.09;
$ergebnisYen = $betrag*8.0358;
$ergebnisPES = $betrag*0.00;
if($mwst=ja){
switch($rate)
{
case 'Dollar':
echo 'Dies sind '.$ergebnisDollar*1,16.' Yuan'; break;
case 'Euro':
echo 'Dies sind '.$ergebnisEuro*1,16.' Yuan'; break;
case 'Yen':
echo 'Dies sind '.$ergebnisYen*1,16.' Yuan'; break;
case 'PES':
echo 'Dies sind '.$ergebnisPES*1,16.' Yuan'; break;
}
}
else{
switch($rate)
{
case 'Dollar':
echo 'Dies sind '.$ergebnisDollar.' Yuan'; break;
case 'Euro':
echo 'Dies sind '.$ergebnisEuro.' Yuan'; break;
case 'Yen':
echo 'Dies sind '.$ergebnisYen.' Yuan'; break;
case 'PES':
echo 'Dies sind '.$ergebnisPES.' Yuan'; break;
}
}
?>
</center>
<h2>Ausgangswährung</h2>
<form action="rmb.php" method="post">
<select name="rate">
<option value="Dollar">Dollar</option>
<option value="Euro">Euro</option>
<option value="Yen">Yen</option>
<option value="PES">Pesetes</option>
</select><br><br>
<b>Mwst</b>
<input type="checkbox" name="mwst" value="checkbox"><br><br>
<b>Betrag</b><br>
<input type="text" name="betrag" size="20">
<input type="submit" name="submit" value="Berechnen">
</form></body></html>
Perhaps this is wrong:
'.$ergebnisDollar*1,16.'
I didnt realy know how to write it.
PLZ HELP
thx
joe
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Mon Oct 31, 2005 9:45 pm
multiple things are actually wrong:
should be
or
and
Code: Select all
echo 'Dies sind '.$ergebnisDollar*1,16.' Yuan'; break;should be
Code: Select all
echo 'Dies sind '.($ergebnisDollar*1.16).' Yuan'; break;
joecrack
Forum Commoner
Posts: 99 Joined: Mon Oct 31, 2005 9:17 pm
Post
by joecrack » Mon Oct 31, 2005 11:33 pm
I changed everything but still nor working.
Also i had to write it this:
Code: Select all
if($mwst=='ja'){
switch($rate)
{
case 'Dollar':
echo 'Dies sind .($ergebnisDollar*1,16). Yuan'; break;
case 'Euro':
echo 'Dies sind .($ergebnisEuro*1,16). Yuan'; break;
case 'Yen':
echo 'Dies sind .($ergebnisYen*1,16). Yuan'; break;
case 'PES':
echo 'Dies sind .($ergebnisPES*1,16). Yuan'; break;
}
}
But still its doesn't mulitply with with 1.16 !?!?!
till
joecrack
Forum Commoner
Posts: 99 Joined: Mon Oct 31, 2005 9:17 pm
Post
by joecrack » Mon Oct 31, 2005 11:46 pm
Hi
i allready korrekted:
Code: Select all
<input type="checkbox" name="mwst" [color=red]value="ja"[/color]>
still nor working
joe
joecrack
Forum Commoner
Posts: 99 Joined: Mon Oct 31, 2005 9:17 pm
Post
by joecrack » Mon Oct 31, 2005 11:52 pm
If i write it like this:
Code: Select all
if($mwst=='ja'){
switch($rate)
{
case 'Dollar':
echo 'Dies sind '.($ergebnisDollar*1,16).' Yuan'; break;
I get
^^
Whats wrong
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Tue Nov 01, 2005 12:13 am
the decimal in the mutliplier must be a period (.) not a comma (,) .. as I showed in my example...
joecrack
Forum Commoner
Posts: 99 Joined: Mon Oct 31, 2005 9:17 pm
Post
by joecrack » Tue Nov 01, 2005 12:24 am
Yeah ...
thanks a lot
joe