title: Currency Converter Using PHP
body: <p>I am new to PHP so i am not sure what i am doing wrong but it seems only last if statement is getting executed which is USD to USD no matter what currencies i pick. </p>
  
  <p>I need to make it so it converts FROM and TO currency that i pick and the conversion gets displayed in the amount_output box. And that currencies and the mount i typed in remain in the results without getting reset.</p>
  
  <p>Any help it greatly appreciated.</p>
  
  <pre><code>&lt;?php                
  $amount_input = filter_input(INPUT_POST, 'amount_input');
  $currency1 = filter_input(INPUT_POST, 'currency1');
  $currency2 = filter_input(INPUT_POST, 'currency2');
  
  if ($currency1="CAD" AND $currency2="CAD")
  {
      $amount_output = $amount_input*1.0;
  }
  
  if ($currency1="CAD" AND $currency2="EUR")
  {
      $amount_output = $amount_input*0.624514066;
  }       
  
  if ($currency1="CAD" AND $currency2="GBP")
  {
      $amount_output = $amount_input*0.588714763;
  }       
  
  if ($currency1="CAD" AND $currency2="USD")
  {
      $amount_output = $amount_input*0.810307;
  }       
  if ($currency1="EUR" AND $currency2="CAD")
  {
      $amount_output = $amount_input*1.601244959;
  }
  
  if ($currency1="EUR" AND $currency2="EUR")
  {
      $amount_output = $amount_input*1.0;
  }       
  
  if ($currency1="EUR" AND $currency2="GBP")
  {
      $amount_output = $amount_input*0.942676548;
  }       
  
  if ($currency1="EUR" AND $currency2="USD")
  {
      $amount_output = $amount_input*1.2975;
  }
  
  if ($currency1="GBP" AND $currency2="CAD")
  {
      $amount_output = $amount_input*1.698615463;
  }
  
  if ($currency1="GBP" AND $currency2="EUR")
  {
      $amount_output = $amount_input*1.060809248;
  }       
  
  if ($currency1="GBP" AND $currency2="GBP")
  {
      $amount_output = $amount_input*1.0;
  }       
  
  if ($currency1="GBP" AND $currency2="USD")
  {
      $amount_output = $amount_input*1.3764;
  } 
  
  if ($currency1="USD" AND $currency2="CAD")
  {
      $amount_output = $amount_input*1.234100162;
  }
  
  if ($currency1="USD" AND $currency2="EUR")
  {
      $amount_output = $amount_input*0.772200772;
  }       
  
  if ($currency1="USD" AND $currency2="GBP")
  {
      $amount_output = $amount_input*0.726532984;
  }       
  
  if ($currency1="USD" AND $currency2="USD")
  {
      $amount_output = $amount_input*1.0;
  } 
  ?&gt; 
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;!--
  To change this license header, choose License Headers in Project Properties.
  To change this template file, choose Tools | Templates
  and open the template in the editor.
  --&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
      &lt;title&gt;F/X Calculator&lt;/title&gt;
      &lt;link href="fxCalcStyles.css" rel="stylesheet" type="text/css" /&gt;
  
  &lt;/head&gt;
  &lt;body&gt;        
      &lt;h1&gt;Money Banks F/X Calculator&lt;/h1&gt;
      &lt;hr&gt;&lt;/hr&gt;
      &lt;form action="fxCalc.php" method="post"&gt;                
          &lt;select name="currency1"&gt;
              &lt;option value="CAD"&gt;CAD&lt;/option&gt;
              &lt;option value="EUR"&gt;EUR&lt;/option&gt;
              &lt;option value="GBP"&gt;GBP&lt;/option&gt;
              &lt;option value="USD"&gt;USD&lt;/option&gt;
          &lt;/select&gt;
          &lt;input name="amount_input" type="text"/&gt;
          &lt;select name="currency2"&gt;
              &lt;option value="CAD"&gt;CAD&lt;/option&gt;
              &lt;option value="EUR"&gt;EUR&lt;/option&gt;
              &lt;option value="GBP"&gt;GBP&lt;/option&gt;
              &lt;option value="USD"&gt;USD&lt;/option&gt;
          &lt;/select&gt;
          &lt;input name="amount_output" type="text" value="&lt;?php echo $amount_output ?&gt;" readonly="readonly"/&gt;
  
          &lt;br /&gt;
  
          &lt;input type="submit" name="submit" value="Convert"&gt;&lt;/input&gt;
          &lt;input type="reset" name="reset" value="Reset"&gt;&lt;/input&gt;
  
      &lt;/form&gt;                        
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>