I have a quick coding problem. I will post my php code below this message. I have everything working except for the column headers for the table. I can get the first column header (“DOLLARS”) to work but I can’t figure out where to put the header code to get the second column header to work. The second header uses the php variable $currency so that whichever foreign currency that the user wants to convert from dollars to $currency (i.e. convert DOLLARS into PESOS or EUROS etc). Anyway here is the code with the problem line highlighted:
Currency Converter<?php
$country = $_POST['country'];
print("<h1>Currency Converter: $country</h1>");
print("<table border=\"1\">");
[size=18pt]
print(“
for ($usDollar = 100; $usDollar <= 1000; $usDollar = $usDollar + 100)
{
print("<tr>");
if($country == "Chile")
{
$currency = "PESOS";
$conversionFactor = 466;
}
elseif($country == "Egypt")
{
$currency = "POUNDS";
$conversionFactor = 5.94293;
}
elseif($country == "Italy")
{
$currency = "EUROS";
$conversionFactor = 0.68822;
}
elseif($country == "Japan")
{
$currency = "YEN";
$conversionFactor = 80.78;
}
elseif($country == "Spain")
{
$currency = "EUROS";
$conversionFactor = 0.68822;
}
$convertedCurrency = $conversionFactor * $usDollar;
print("<tr>");
print("<td>$".number_format($usDollar, 2)."</td>");
print("<td>$".number_format($convertedCurrency, 2)."</td>");
print("</tr>");
}
print("</table>");
?>