PHP condition checking for country
<p>Hi have to check for 2 countries in order to setup a shipping cost. (These values are previously assigned via a dropdown list). Here's my PHP condition, it doesn't seem to work. Can someone please help me with the syntax if I'm doing a mistake?</p>

<pre><code>&lt;?php
for( $y = 0; $y &lt; count( $contentsArray ); $y++ )
{

  $itemArray = explode( ":", $contentsArray[ $y ] );

  $price = number_format( $itemArray[ 2 ] * $itemArray[ 1 ], 2 );
  $subtotal += $price;

  echo "&lt;tr&gt;";
  echo "&lt;td class='item_col'&gt;" . $itemArray[ 0 ] . "&lt;/td&gt;";
  echo "&lt;td class='description_col'&gt;" . $itemArray[ 3 ] . "&lt;/td&gt;";
  echo "&lt;td class='quantity_col'&gt;" . $itemArray[ 1 ] . "&lt;/td&gt;";
  echo "&lt;td class='price_col'&gt;$ " . $price . "&lt;/td&gt;";
  echo "&lt;/tr&gt;";
}

// calculate the shipping  



if( $subtotal &gt; 500 )
  $shipping = 0.00;
</code></pre>

<p>// ---- This is where I'm trying to add my condition and bugs ------</p>

<pre><code>else if ( $country == "Canada" )
  $shipping = 10.00;
else if ( $country == "USA" )
  $shipping = 10.00;
</code></pre>

<p>// ---- Above where I'm trying to add my condition ------  </p>

<p>else
      $shipping = 15.00;</p>

<pre><code>$shipping = number_format( $shipping, 2 );  




// calculate the tax and total for the cart
$gst = number_format( ( $subtotal + $shipping ) * 0.06, 2 );
$total = $subtotal + $shipping + $gst;

// update the totals in the db
$cartData-&gt;totals = $shipping . "|" . $gst . "|" . $total;
$updateSuccess = updateCartTotals( $merchant, $cartData );
?&gt;

&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;

&lt;div id="invoice_totals"&gt;
  &lt;div id="totals"&gt;
    $ &lt;?=number_format( $subtotal, 2 )?&gt;&lt;br /&gt;
    $ &lt;?=number_format( $shipping, 2 )?&gt;&lt;br /&gt;
    $ &lt;?=number_format( $gst, 2 )?&gt;&lt;br /&gt;
    &lt;span class="total"&gt;$ &lt;?=number_format( $total, 2 )?&gt;&lt;/span&gt;
  &lt;/div&gt;

  &lt;div id="headings"&gt;
    &lt;strong&gt;subtotal:&lt;/strong&gt;&lt;br /&gt;
    &lt;strong&gt;shipping:&lt;/strong&gt;&lt;br /&gt;
    &lt;strong&gt;tax:&lt;/strong&gt;&lt;br /&gt;
    &lt;span class="total"&gt;total:&lt;/span&gt;
  &lt;/div&gt;

  &lt;div id="print"&gt;
    &lt;a href="#"&gt;&lt;img src="images/cart/buttons/print.gif" width="41" height="41" border="0" onmouseover="this.src='images/cart/buttons/print_ov.gif'" onmouseout="this.src='images/cart/buttons/print.gif'" /&gt;&lt;/a&gt;
  &lt;/div&gt;

  &lt;div class="cleaner"&gt;&lt;/div&gt;

  &lt;div id="back"&gt;
    &lt;a href="shipping.html"&gt;&lt;img src="images/cart/buttons/back.gif" width="58" height="58" border="0" onmouseover="this.src='images/cart/buttons/back_ov.gif'" onmouseout="this.src='images/cart/buttons/back.gif'" /&gt;&lt;/a&gt;
  &lt;/div&gt;
  &lt;div class="cleaner"&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="shipping_information"&gt;
&lt;p&gt;
  &lt;strong&gt;Shipping to:&lt;/strong&gt;&lt;br /&gt;
  &lt;?=$customerData-&gt;firstName . " " . $customerData-&gt;lastName?&gt;&lt;br /&gt;
  &lt;?=$customerData-&gt;address?&gt;&lt;br /&gt;
  &lt;?=$customerData-&gt;city . ", " . $customerData-&gt;province?&gt;&lt;br /&gt;
  &lt;?=getCountryName( $customerData-&gt;country )?&gt;&lt;br /&gt;
  &lt;?=$customerData-&gt;postalCode?&gt;
&lt;/p&gt;

...
</code></pre>
