Cant get this to work… if $country is United Kingdom it works… if $country is any of the european countries in the second elseif it works…
it is the thrid elseif that i am having the problem with… if $country is anything other than that defined in the first two if’s it still shows it as european postage…
hope this makes sense…
any ideas…
thanks
steve
IF ($country == 'United Kingdom') {
$postageprice = '0';
} ELSEIF ($country == 'Andorra' OR 'Austria' OR 'Belgium' OR 'Bulgaria' OR 'Croatia' OR 'Cyprus' OR 'Czech Republic' OR 'Denmark' OR 'Estonia' OR 'Finland' OR 'France' OR 'Germany' OR 'Greece' OR 'Hungary' OR 'Iceland' OR 'Ireland' OR 'Italy' OR 'Latvia' OR 'Lithuania' OR 'Luxembourg' OR 'Malta' OR 'Monaco' OR 'Netherlands' OR 'Norway' OR 'Poland' OR 'Portugal' OR 'Romania' OR 'Slovakia' OR 'Slovenia' OR 'Spain' OR 'Sweden' OR 'Switzerland' OR 'Turkey' OR 'Ukraine' OR 'Vatican City') {
$postageprice = $oneyeareuropepostage;
echo "</tr><tr>";
echo "<td width='250'>European Postage:</td><td>£$oneyeareuropepostage</td>";
} ELSEIF ($country != 'United Kingdom' OR 'Andorra' OR 'Austria' OR 'Belgium' OR 'Bulgaria' OR 'Croatia' OR 'Cyprus' OR 'Czech Republic' OR 'Denmark' OR 'Estonia' OR 'Finland' OR 'France' OR 'Germany' OR 'Greece' OR 'Hungary' OR 'Iceland' OR 'Ireland' OR 'Italy' OR 'Latvia' OR 'Lithuania' OR 'Luxembourg' OR 'Malta' OR 'Monaco' OR 'Netherlands' OR 'Norway' OR 'Poland' OR 'Portugal' OR 'Romania' OR 'Slovakia' OR 'Slovenia' OR 'Spain' OR 'Sweden' OR 'Switzerland' OR 'Turkey' OR 'Ukraine' OR 'Vatican City') {
$postageprice = $oneyearworldpostage;
echo "</tr><tr>";
echo "<td width='250'>World Postage:</td><td>£$oneyearworldpostage</td>";
}
This will result is both easier to read code as well as better overall performance. While it may be fractions of a second improvement, that ads up when you scale.
Review the overall logic as it really doesn’t look logical.
switch($country)
{
case 'United Kingdom';
$postageprice = '0';
break;
case 'Andorra';
case 'Austria';
case 'Belgium';
case 'Bulgaria';
case 'Croatia';
case 'Cyprus';
case 'Czech Republic';
case 'Denmark';
case 'Estonia';
case 'Finland';
case 'France';
case 'Germany';
case 'Greece';
case 'Hungary';
case 'Iceland';
case 'Ireland';
case 'Italy';
case 'Latvia';
case 'Lithuania';
case 'Luxembourg';
case 'Malta';
case 'Monaco';
case 'Netherlands';
case 'Norway';
case 'Poland';
case 'Portugal';
case 'Romania';
case 'Slovakia';
case 'Slovenia';
case 'Spain';
case 'Sweden';
case 'Switzerland';
case 'Turkey';
case 'Ukraine';
case 'Vatican City';
$postageprice = $oneyeareuropepostage;
echo "</tr><tr>";
echo "<td width='250'>European Postage:</td><td>£$oneyeareuropepostage</td>";
break;
default;
$postageprice = $oneyearworldpostage;
echo "</tr><tr>";
echo "<td width='250'>World Postage:</td><td>£$oneyearworldpostage</td>";
break;
}