Forum Moderators: coopster
1. EMS shipment
2. Registered post
In order.php, customer can select above shipment type. So, I add 2 radio buttons to select the row in mysql.
echo"<tr bgcolor='$colour_1'>
<td align='right' valign='middle' colspan='3' rowspan='2'><font color=\"#990000\">*</font> <b>$la_ship_type_select:</b></td>
<td valign='middle' colspan='3'><input name=\"shipment\" type=\"radio\" value=\"post\" checked>$la_registered_post</td>
</tr>
<tr bgcolor='$colour_1'>
<td valign='middle' colspan='3'><input name=\"shipment\" type=\"radio\" value=\"ems\">$la_ems</td>
</tr>";
----------
CODE?>
<script language="JavaScript">
<?
$resulta=mysql_query("select * from ".$prefix."store_shipzones order by zone_id");
echo "var shipping_costs_array=Array()\n";
while($line=mysql_fetch_array($resulta)) {
echo "shipping_costs_array['".$line['zone_name']."']=".$line[$ship_price]."\n";
}
How do I reference the radio buttons to reflect the $ship_price.
echo"<tr bgcolor='$colour_1'>
<td align='right' valign='middle' colspan='3' rowspan='2'><font color=\"#990000\">*</font> <b>$la_ship_type_select:</b></td>
<td valign='middle' colspan='3'><input name=\"shipment\" type=\"radio\" value=\"post\" checked>$la_registered_post</td>
</tr>
<tr bgcolor='$colour_1'>
<td valign='middle' colspan='3'><input name=\"shipment\" type=\"radio\" value=\"ems\">$la_ems</td>
</tr>"; The original code to print on screen:
echo "shipping_costs_array['".$line['zone_name']."']=".$line['ship_price']."\n"; Where:
1. zone_name - shipment zone
2. ship_price - EMS shipment price
3. post - registered post price
I try to change the code as follow:
if ($shipment=='post');
{
echo "shipping_costs_array['".$line['zone_name']."']=".$line['post']."\n";
}
if ($shipment=='ems');
{
[b]echo "shipping_costs_array['".$line['zone_name']."']=".$line['ship_price']."\n";[/b]
} It will only read the last code (bold). I think must be wrong with radiobutton object cause I'm not sure how to use it.
Please help.