Hi all,
I currently have a page that uses javascript to make visable/invisable a <TR> if a particular condition is met ie. the radio buttons.
This all works fine but what i want to add is, depending on which radio button is selected, i want to add the PHP variable (the shipping cost) to the bottom of the script (where is says "RESULT HERE").
For example, if the Standard Post radio button is selected i want the $pcRate_1 variable to show at the bottom of the script, alternatively, if the Express Post option is selected i want it to display the $pcRate at the bottom.
Any ideas on how to acheive this?
Cheers,
micmac
<?
session_start();
?>
<HTML><HEAD>
<script language="javascript">
<!--
function swapIt(chk) {
if(chk.value == "S") document.getElementById('theRow').style.visibility="visible";
else {
document.getElementById('theRow').style.visibility="hidden";
}
}
// -->
</script>
</HEAD>
<?
if($_SESSION['ship_method'] == 'E'){
?>
<BODY leftMargin=0 topMargin=0 marginwidth="0" marginheight="0" onLoad="swapIt(this)">
<?
} else {
?>
<BODY leftMargin=0 topMargin=0 marginwidth="0" marginheight="0">
<?
}
?>
<TABLE width=290 border=0 cellPadding=0 cellSpacing=0>
<TBODY>
<TR>
<TD colSpan=2><SPAN class=text2boldblue>Shipping methods available for the<BR>
item(s) on left (Please select one):</SPAN></TD>
<TD width=10></TD>
</TR>
<TR>
<TD colSpan=3 height=10><IMG height=10 src="images/spacer.gif" width=10></TD>
</TR>
<TR vAlign=top>
<TD class=text2 width=17><INPUT type=radio <? if($_SESSION['ship_method'] != 'E' || $_SESSION['ship_method'] == 'S') echo "CHECKED"; ?>
value="S" name="ship_method" onClick="swapIt(this)"></TD>
<TD width=251 valign="top" class=text2><B>Standard</B> (3 to 5 business days for shipping, plus processing time*)
<?
if ($pcRate_1 == 0){
echo "<b>FREE</b>";
} else {
echo "$".number_format($pcRate_1, 2, ".", ",");
}
?>
</TD>
<TD width=10><IMG height=10 src="images/spacer.gif" width=10></TD>
</TR>
<TR>
<TD colSpan=3 height=10><IMG height=10 src="images/spacer.gif" width=10></TD>
</TR>
<TR vAlign=top>
<TD class=text2 width=17><INPUT type=radio <? if($_SESSION['ship_method'] == 'E') echo "CHECKED"; ?> value="E" name="ship_method" onClick="swapIt(this)"></TD>
<TD class=text2 width=251><B>Express</B> (1 business day for shipping, plus processing time*) $<? echo number_format($pcRate, 2, ".", ","); ?></TD>
<TD width=10><IMG height=10 src="images/spacer.gif" width=10></TD>
</TR>
<TR>
<TD colSpan=3 height=10><IMG height=10 src="images/spacer.gif" width=10></TD>
</TR>
<TR vAlign=top style="visibility:visible" id="theRow">
<TD class=text2 width=17>
<input type="checkbox" name="reg_post" value="Y" <? if($_SESSION['reg_post'] == 'Y') echo "CHECKED"; ?>></TD>
<TD class=text2 width=251>If you would like SWIFTFLIX to ship your order <strong>Registered Post</strong> please tick the box on the left. (Standard Post Only)</TD>
<TD width=10><IMG height=10 src="images/spacer.gif" width=10></TD>
</TR>
<TR>
<TD colSpan=3 height=10><IMG height=10 src="images/spacer.gif" width=10></TD>
</TR>
<TR>
<TD colSpan=3 height=10>RESULT HERE</TD>
</TR>
</TBODY>
</TABLE>