Bellinis
11-07-2005, 01:56 PM
Hello all!
I created a small currency convertor for my vbadvanced portal, but I can't get it into place :(
Here's the code:
<form name="form1" method="post" action="">
<table width="160" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2"> <?
include('function.php');
$value=$today_rate;
if ($today_rate>$yesterday_rate) {
$diff=$today_rate-$yesterday_rate;
if ($diff>0) {
$percent=substr($yesterday_rate/($diff*100),0,4);
} else {$percent='0.00';}
$sign='+';
}
else {
$diff=$yesterday_rate-$today_rate;
if ($diff>0) {
$percent=substr($yesterday_rate/($diff*100),0,4);
} else {$percent='0.00';}
$sign='-';
}
?>
<div align="center"><br>
<strong><span class="style3"><img src="EUR.gif" alt="EURO" width="18" height="12"> EUR
<img src="arrow.png" width="9" height="9"> CZK <img src="CZK.gif" alt="CZK" width="18" height="12"> </span></strong><span class="style7">:<strong><br>
1<span class="style3"> <img src="arrow.png" width="9" height="9"></span> <? echo $value;
if ($percent!='0.00') {echo '<br>'.$sign.' '.$percent.'%';
if ($sign=='-') {
echo '<img src="down.gif" alt="down" width="7" height="8">';
} else {echo '<img src="up.gif" alt="down" width="7" height="8">';}
} else {echo '<br>'.' '.$percent.'%';
echo '<img src="down.gif" alt="down" width="7" height="8">';
echo '<img src="up.gif" alt="down" width="7" height="8">';
};
?></strong></span>
</div>
</div></td>
</tr>
<tr>
<td colspan="2"><strong>Reken om: </strong></td>
</tr>
<tr>
<td width="107"><span class="style3">Waarde</span></td>
<td width="222"><input name="convert_value" type="text" id="convert_value" size="6"> </td>
</tr>
<tr>
<td> </td>
<td><select name="mode" id="select">
<option value="a" selected>EUR-CZK</option>
<option value="b">CZK - EUR</option>
</select></td>
</tr>
<tr>
<td> </td>
<td><input name="submit" type="submit" id="submit3" value="Reken om"></td>
</tr>
<tr>
<td colspan="2"><div align="center" class="style3">
<?
if (isset($_REQUEST['submit'])) {
switch ($_REQUEST['mode']) {
case 'a':$result=$_REQUEST['convert_value']*$value;
echo $_REQUEST['convert_value'].' EUR='.$result.' CZK';
break;
case 'b':
$r=1/$value;
$result=$r*$_REQUEST['convert_value'];
echo $_REQUEST['convert_value'].' CZK='.substr($result,0,4).' EUR';
break;
}
}
?></div></td>
</tr>
</table>
</form>
<tr>
<td class="$bgclass">
content_here
</td>
</tr>
Also I tried placing that second piece of code, but it didn't work either (notice the bg color).
The working script can be found here:
http://www.tsjechie.net/board/modules/index1.php
What am I doing wrong? :(
I hope somebody can help me out here....
I created a small currency convertor for my vbadvanced portal, but I can't get it into place :(
Here's the code:
<form name="form1" method="post" action="">
<table width="160" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2"> <?
include('function.php');
$value=$today_rate;
if ($today_rate>$yesterday_rate) {
$diff=$today_rate-$yesterday_rate;
if ($diff>0) {
$percent=substr($yesterday_rate/($diff*100),0,4);
} else {$percent='0.00';}
$sign='+';
}
else {
$diff=$yesterday_rate-$today_rate;
if ($diff>0) {
$percent=substr($yesterday_rate/($diff*100),0,4);
} else {$percent='0.00';}
$sign='-';
}
?>
<div align="center"><br>
<strong><span class="style3"><img src="EUR.gif" alt="EURO" width="18" height="12"> EUR
<img src="arrow.png" width="9" height="9"> CZK <img src="CZK.gif" alt="CZK" width="18" height="12"> </span></strong><span class="style7">:<strong><br>
1<span class="style3"> <img src="arrow.png" width="9" height="9"></span> <? echo $value;
if ($percent!='0.00') {echo '<br>'.$sign.' '.$percent.'%';
if ($sign=='-') {
echo '<img src="down.gif" alt="down" width="7" height="8">';
} else {echo '<img src="up.gif" alt="down" width="7" height="8">';}
} else {echo '<br>'.' '.$percent.'%';
echo '<img src="down.gif" alt="down" width="7" height="8">';
echo '<img src="up.gif" alt="down" width="7" height="8">';
};
?></strong></span>
</div>
</div></td>
</tr>
<tr>
<td colspan="2"><strong>Reken om: </strong></td>
</tr>
<tr>
<td width="107"><span class="style3">Waarde</span></td>
<td width="222"><input name="convert_value" type="text" id="convert_value" size="6"> </td>
</tr>
<tr>
<td> </td>
<td><select name="mode" id="select">
<option value="a" selected>EUR-CZK</option>
<option value="b">CZK - EUR</option>
</select></td>
</tr>
<tr>
<td> </td>
<td><input name="submit" type="submit" id="submit3" value="Reken om"></td>
</tr>
<tr>
<td colspan="2"><div align="center" class="style3">
<?
if (isset($_REQUEST['submit'])) {
switch ($_REQUEST['mode']) {
case 'a':$result=$_REQUEST['convert_value']*$value;
echo $_REQUEST['convert_value'].' EUR='.$result.' CZK';
break;
case 'b':
$r=1/$value;
$result=$r*$_REQUEST['convert_value'];
echo $_REQUEST['convert_value'].' CZK='.substr($result,0,4).' EUR';
break;
}
}
?></div></td>
</tr>
</table>
</form>
<tr>
<td class="$bgclass">
content_here
</td>
</tr>
Also I tried placing that second piece of code, but it didn't work either (notice the bg color).
The working script can be found here:
http://www.tsjechie.net/board/modules/index1.php
What am I doing wrong? :(
I hope somebody can help me out here....