I have 3 arrays created from a previous form where a user selects the check boxes of the domains he/she wants to purchase. What I want is for the domain extensions to be matched with the 'if' statements to produce the cost of each domain in the 'print statement'.
Problem is the prices are just listed in the in the order of the 'if' statements and are not set according to the domain extensions (.com, .co.uk etc...)
Can anyone help? Here is the code...
foreach ($register_dom as $iregister_dom) {
list ($r, $idomain_name) = each($domain_name);
list ($s, $iextension) = each($extension);
if ($iextension == 'co.uk') {
$reg_cost = "5.99";
}
elseif ($iextension == 'ltd.uk') {
$reg_cost = "5.99";
}
elseif ($iextension == 'plc.uk') {
$reg_cost = "5.99";
}
elseif ($iextension == 'net.uk') {
$reg_cost = "5.99";
}
elseif ($iextension == 'org.uk') {
$reg_cost = "5.99";
}
elseif ($iextension == 'com') {
$reg_cost = "11.99";
}
elseif ($iextension == 'net') {
$reg_cost = "11.99";
}
elseif ($iextension == 'org') {
$reg_cost = "11.99";
}
elseif ($iextension == 'uk.co') {
$reg_cost = "21.99";
}
elseif ($iextension == 'biz') {
$reg_cost = "21.99";
}
elseif ($iextension == 'info') {
$reg_cost = "21.99";
}
elseif ($iextension =='uk.com') {
$reg_cost = "47.99";
}
elseif ($iextension == 'uk.net') {
$reg_cost = "47.99";
}
elseif ($iextension == 'gb.com') {
$reg_cost = "47.99";
}
elseif ($iextension == 'gb.net') {
$reg_cost = "47.99";
}
elseif ($iextension == 'ws') {
$reg_cost = "41.99";
}
elseif ($iextension == 'eu.com') {
$reg_cost = "45.99";
}
elseif ($iextension == 'me.uk') {
$reg_cost = "88.99";
}
print ("<tr>
<td width='50%' bgcolor='#3399CC' align='center'><font face='verdana' size='2' color='#FFFFFF'><input type='hidden' name='dom_price[]' value='$reg_cost'>$iregister_dom<input type='hidden' name='reg_domains[]' value='$iregister_dom'></font></td>
<td width='50%' bgcolor='#3399CC' align='center'><font face='verdana' size='2' color='#FFFFFF'><select size ='1' name='domain_host[]' class='input'>$host</select></font></td>
</tr>");
}