Paypal radio buttons with mutiple price options

BrighteyesDesign
BrighteyesDesign used Ask the Experts™
on
I have set up a form using Paypal. The options (including price) are selected by radio buttons.

I also have an add-on price modifier that i need to include. I can't seem to get this to work. The price seems to alwys be the same.

Here's the live page http://www.brighteyesdesign.co.uk/tlc/book.html


 I know the attached code is close because is was working. I must have altered it somehow!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Learn Spanish, Trujillo Language Centre, Peru</title>
<meta name="description" content="A Spanish Language School in the City of Eternal Spring. The Trujillo Language Centre is located in the lovely colonial city of Trujillo on the Pacific coast of South America." />
 
<link href="tlc.css" rel="stylesheet" type="text/css" />
 
 
<script src="Scripts/swfobject_modified.js" type="text/javascript"></script>
 
<script src="mootools.v1.11.js" type="text/javascript"></script>
<script src="nogray_date_calendar_vs1_min.js" type="text/javascript"></script>
 
 
<script language="javascript">
 
	window.addEvent("domready", function(){
		var calender1 = new Calendar("calendar1", "cal1_toggler", {inputField:'os1',
																	startDate:'today+1', datesOff:[{date:25, month:11,},{date:26, month:11,}]});
});
</script>
<link href="nogray_calendar_vs1.css" rel="stylesheet" type="text/css" />
<style>
	* {font-family:Arial, Helvetica, sans-serif;
		font-size:9pt;}
		
	/* calendar styles */
	#calendar1 {border:solid #666666 1px;
		background:#ffffff;
		padding-bottom:5px;
		padding-top:5px;
		width:183px;}
	#calendar1 .ng-cal-header-table {width:173px;}
	
</style><!--
 
 
//-->
</script>
<script language="javascript">
 
function CalculateOrder(form){
 var radG1;
 var radG2;
 
for (var i = 0; i < document.myform.os0.length; i++){
 if(document.myform.os0[i].checked==true){radG1=document.myform.os0[i].value;}
}
for (var i = 0; i < document.myform.os5.length; i++){
 if(document.myform.os5[i].checked==true){radG2=document.myform.os5[i].value;}
}
// alert(radG1+' '+radG2);
 
 
 
if(radG1 == "Everyday Spanish (Beginners)")
 {
 document.myform.amount.value = '295.00';
 
 }
else if(radG1 == "Everyday Spanish Plus (Beginners)")
 {
 document.myform.amount.value = '395.00';
 }
 
 
else if(radG1 == "Everyday Spanish (Intermediate)")
 {
 document.myform.amount.value = '295.00';
 
 }
else if(radG1 == "Everyday Spanish Plus (Intermediate)")
 {
 document.myform.amount.value = '395.00';
 }
 
 
 
 
 
else if(radG1 == "Everyday Spanish (Beginners)" && radG2 == "Breakfast and single room")
 {
 document.myform.amount.value = '395.00';
 
 }
else if(radG1 == "Everyday Spanish (Beginners)" && radG2 =="Breakfast, dinner and single room")
 {
 document.myform.amount.value = '415.00';
  }
 
 
else if(radG1 == "Everyday Spanish Plus (Beginners)" && radG2 == "Breakfast and single room")
 {
 document.myform.amount.value = '495.00';
 
 }
else if(radG1 == "Everyday Spanish Plus (Beginners)" && radG2 =="Breakfast, dinner and single room")
 {
 document.myform.amount.value = '515.00';
 
 
 }
 
 
else if(radG1 == "Everyday Spanish (Intermediate)" && radG2 == "Breakfast and single room")
 {
 document.myform.amount.value = '395.00';
 
 }
else if(radG1 == "Everyday Spanish (Intermediate)" && radG2 =="Breakfast, dinner and single room")
 {
 document.myform.amount.value = '415.00';
  }
 
 
else if(radG1 == "Everyday Spanish Plus (Intermediate)" && radG2 == "Breakfast and single room")
 {
 document.myform.amount.value = '495.00';
 
 }
else(radG1 == "Everyday Spanish Plus (Intermediate)" && radG2 =="Breakfast, dinner and single room")
 {
 document.myform.amount.value = '515.00';
 }  
}
// -->
</script>
 
 
<tr>
  <td>&nbsp;</td>
</tr>
</table>
 
</head>
 
<body>
<table width="835" height="97" border="0" align="center" cellpadding="0" cellspacing="0" class="maintable">
  <tr>
    <td height="72" valign="top"><table border="0" cellpadding="0" cellspacing="0" class="contenttable">
      <tr>
        <td align="center"><table border="0" align="center" cellpadding="20" cellspacing="0" class="toptable">
          <tr>
            <td width="463"><img src="images/trujuillo-logo.jpg" width="304" height="90" alt="Trujillo Logo" /></td>
            <td width="457" align="right" valign="bottom"><table border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td align="right"><a href="mailto:info@peru-language-school.com"><img src="images/mail.jpg" alt="email trujillo" width="38" height="64" border="0" /></a></td>
                <td><a href="http://pub3.bravenet.com/chat/show.php?usernum=219189705&amp;cpv=2"><img src="images/livechat.jpg" alt="chat with Trujillo LAnguage centre" width="64" height="64" border="0" /></a></td>
                <td><img src="images/facebook.jpg" width="65" height="64" alt="facebook Trujillo Language Centre" /></td>
                <td><img src="images/skype.jpg" width="64" height="64" alt="Skype Trujillo Language Centre" /></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td align="center" valign="top"><table border="0" cellpadding="0" cellspacing="0" class="middletable">
          <tr>
            <td width="262">&nbsp;</td>
            <td width="718"><table width="718" border="0" cellpadding="0" cellspacing="1">
              <tr>
                <td width="55"><table width="55" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td><p class="navigationleft"><a href="index.html" class="navigationleft">HOME</a></p></td>
                  </tr>
                </table></td>
                <td width="77"><table width="73" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td><p class="navigation"><a href="trujillo.html" class="navigation">TRUJILLO</a></p></td>
                  </tr>
                </table></td>
                <td width="100"><table width="100" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td><p class="navigation"><a href="courses.html" class="navigation">OUR COURSES</a></p></td>
                  </tr>
                </table></td>
                <td width="68"><table width="65" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td><p class="navigation"><a href="school.html" class="navigation">SCHOOL</a></p></td>
                  </tr>
                </table></td>
                <td width="50"><table width="48" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td><p class="navigation"><a href="blog.php" class="navigation">BLOG</a></p></td>
                  </tr>
                </table></td>
                <td width="105"><table width="110" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td><p class="navigation"><a href="accommodation.html" class="navigation">ACCOMODATION</a></p></td>
                  </tr>
                </table></td>
                <td width="75"><table width="78" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td><p class="navigation"><a href="book.html" class="navigation">BOOKINGS</a></p></td>
                  </tr>
                </table></td>
                <td width="45"><table width="45" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td><p class="navigation"><a href="faq.html" class="navigation">FAQ's</a></p></td>
                  </tr>
                </table></td>
                <td width="52"><table width="52" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td><p class="navigation"><a href="links.html" class="navigation">LINKS</a></p></td>
                  </tr>
                </table></td>
                <td width="121"><table width="90" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td><p class="navigationright"><a href="contact.html" class="navigationright">CONTACT US</a></p></td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td colspan="2" align="right" valign="top"><table width="400" border="0" cellpadding="0" cellspacing="0" class="flash">
              <tr>
                <td valign="top"><table border="0" cellpadding="0" cellspacing="0" class="quotebox">
                  <tr>
                    <td align="center"><table width="210" height="20" border="0" cellpadding="0" cellspacing="0">
                      <tr>
                        <td class="whitecopy"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
                          <HTML>
                          <!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } 	-->
                          <p><span lang="en-GB" xml:lang="en-GB">... is more recognised by its lavish colonial architecture and colourful old mansions.  The city is lively and cosmopolitan, but known for its friendly citizenry and is small enough to get to know in a couple of days.</span></p>
                          <p><span lang="en-GB" xml:lang="en-GB">The coastal climate here is ideal, as its warm and dry without the fog you get around Lima, or the intensive heat characteristic of the northern deserts.</span></p>
                          <br />
<span class="whitecopybold">The Rough Guide 2009</span></td>
                      </tr>
                    </table></td>
                  </tr>
                </table></td>
                <td valign="top"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="726" height="285" align="top" id="FlashID" title="Trujillo pictures">
                  <param name="movie" value="flash/bigpic.swf" />
                  <param name="quality" value="high" />
                  <param name="wmode" value="opaque" />
                  <param name="swfversion" value="6.0.65.0" />
                  <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you dont want users to see the prompt. -->
                  <param name="expressinstall" value="Scripts/expressInstall.swf" />
                  <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
                  <!--[if !IE]>-->
                  <object data="flash/bigpic.swf" type="application/x-shockwave-flash" width="726" height="285" align="top">
                    <!--<![endif]-->
                    <param name="quality" value="high" />
                    <param name="wmode" value="opaque" />
                    <param name="swfversion" value="6.0.65.0" />
                    <param name="expressinstall" value="Scripts/expressInstall.swf" />
                    <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
                    <div>
                      <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
                      <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
                      </div>
                    <!--[if !IE]>-->
                    </object>
                  <!--<![endif]-->
                </object></td>
</tr>
              <tr> </tr>
            </table>
              <table width="400" border="0" cellpadding="0" cellspacing="0" class="flash">
                <tr>                </tr>
              </table></td>
            </tr>
        </table></td>
      </tr>
      <tr>
        <td align="center"><table width="150" border="0" cellpadding="0" cellspacing="0" class="content">
          <tr>
            <td><table width="990" height="20" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td width="812"><table border="0" cellpadding="25" cellspacing="0" class="widebgCopy">
                  <tr>
                    <td height="86" align="left" valign="top"><table width="493" border="0" cellpadding="0" cellspacing="0" class="titledots">
                      <tr>
                        <td><span class="title">Booking Form</span></td>
                        </tr>
                      </table>                     
                      </td>
                    </tr>
                  <tr>
                    <td align="left" valign="top"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
                      <table width="564" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                          <td><form target="_self" action="https://www.paypal.com/cgi-bin/webscr" method="post" name="myform">
                            <table border="0" cellpadding="0" cellspacing="0" class="formbox">
                              <tr>
                                <td colspan="2"><table width="620" border="0" cellspacing="5" cellpadding="5">
                                  <tr>
                                    <td bgcolor="#C72310" class="whitecopybold">Course Details</td>
                                    </tr>
                                  <tr>
                                    <td bgcolor="#FFFFFF"><p>
                                      <input type="hidden" name="on0" value="Course Type " />
                                      <span class="whyuspointsred">Please select your course type:</span><br />
                                      <input name="os0" type="radio" value="Everyday Spanish (Beginners)" checked="checked" />
                                      <span class="whyuspointsred">$295 </span><span class="homewording"><span class="homecopybold">Everyday Spanish (Beginners)</span> - 20 group hours per week for 2 weeks</span><br />
                                      <input name="os0" type="radio" value="Everyday Spanish Plus (Beginners)" />
                                      <span class="whyuspointsred">$395</span><span class="homecopybold"> Everyday Spanish Plus (Beginners)</span><span class="homewording"> - 20 group hours and 5 one to one hours per week</span></p>
                                      <p><span class="homewording">
                                        <input name="os0" type="radio" value="Everyday Spanish (Intermediate)" />
                                        <span class="whyuspointsred">$295 </span><span class="homecopybold">Everyday Spanish (Intermediate)</span> - 20 group hours per week for 2 weeks<br />
                                        <input name="os0" type="radio" value="Everyday Spanish Plus (Intermediate)" />
                                        <span class="whyuspointsred">$395</span><span class="homecopybold"> Everyday Spanish Plus (Intermediate)</span> - 20 group hours and 5 one to one hours per week<br />
                                        <br />
                                        <span class="whyuspointsred">Please select your course start date:</span><br />
                                        <input type="hidden" name="on1" value="Date "><input name="os1" type="text" class="copy" id="os1" size="20" />
                                        <a href="#" id="cal1_toggler">Open Calendar</a> </span>
                                        </p>
                                      <div id="calendar1"></div>
                                      <span class="homewording"><br />
                                        <br />
                                        </span></td>
                                    </tr>
                                  </table></td>
                                </tr>
                              <tr>
                                <td colspan="2"><table width="620" border="0" cellspacing="5" cellpadding="5">
                                  <tr>
                                    <td bgcolor="#C72310" class="whitecopybold">Accommodation</td>
                                    </tr>
                                  <tr>
                                    <td bgcolor="#FFFFFF"><span class="homewording"><span class="whyuspointsred">Where do you wish to stay?</span><br />
                                      <input type="hidden" name="on2" value="Accommodation " />
                                      <input name="os2" type="radio" value="Home stay accomodation" checked="checked" />
                                      </span><span class="homecopybold">Home stay accomodation</span><span class="homewording"><br />
                                        <input name="os2" type="radio" value="A hotel booked through the school" />
                                        </span><span class="homecopybold">A hotel booked through the school</span><span class="homewording"><br />
                                          <input name="os2" type="radio" value="Accommodation arranged by yourself" />
                                          </span><span class="homecopybold">Accommodation arranged by yourself</span><span class="homewording"><br />
                                            <br />
                                            </span></td>
                                    </tr>
                                  </table></td>
                                </tr>
                              <tr>
                                <td colspan="2"><table width="620" border="0" cellspacing="5" cellpadding="5">
                                  <tr>
                                    <td bgcolor="#C72310" class="whitecopybold">Home Stay Options</td>
                                    </tr>
                                  <tr>
                                    <td bgcolor="#FFFFFF"><span class="homewording"><span class="whyuspointsred">Do you smoke?</span><br />
                                      <input type="hidden" name="on3" value="Do you smoke? " />
                                      <input name="os3" type="radio" value="yes" />
                                      </span><span class="homecopybold">Yes</span><span class="homewording"><br />
                                        <input name="os3" type="radio" value="no" checked="checked" />
                                        </span><span class="homecopybold">No</span><span class="homewording"><br />
                                          <br />
                                          <span class="whyuspointsred">If you smoke, do you agree not to smoke inside the home stay house?</span><br />
                                          <input type="hidden" name="on4" value="Agree not to smoke? " />
                                          <input name="os4" type="radio" value="yes" checked="checked" />
                                          <span class="homecopybold">Yes</span><br />
                                          <input name="os4" type="radio" value="no" />
                                          <span class="homecopybold">No</span><br />
                                          <br />
                                          <span class="whyuspointsred">Room and meal options</span><br />
                                          <input type="hidden" name="on5" value="Room type " />
                                          <input name="os5" type="radio" value="Breakfast and single room" />
                                          <span class="homecopybold"><span class="whyuspointsred">$100 </span>Breakfast and single room</span><br />
                                          <input name="os5" type="radio" value="Breakfast, dinner and single room" />
                                          <span class="homecopybold"><span class="whyuspointsred">$120 </span>Breakfast, dinner and single room</span></span><span class="homewording"><br />
                                            <br />
                                            </span><span class="whyuspointsred">Please advise us of any special requirements eg dietry or medical </span><span class="homewording"><br />
                                              <input name="on6" type="hidden" id="on6" value="Info ">
                                              <textarea name="os6" cols="68" rows="10" class="copy" id="os6"></textarea>
                                              <br />
                                              <br />
                                              <input type="hidden" name="on6" value="Accept terms? " />
                                      <input name="os6" type="checkbox" value="yes" />
                                      <a href="terms.html">I accept the terms &amp; conditions.</a><br />
                                              <br />
                                              <input type="image" src="images/book.jpg" border="0" name="submit" onclick="CalculateOrder(this.form)" alt="Make payments with PayPal - it's fast, free and secure!" />
                                              </span></td>
                                    </tr>
                                  </table></td>
                                </tr>
                              <tr>
                                <td colspan="2" bgcolor="#FFFFFF"><input type="hidden" name="cmd" value="_cart" />
                                  <input type="hidden" name="add" value="1" />
                                  <input type="hidden" name="business" value="oolibooli@hotmail.com" />
                                  <input type="hidden" name="item_number" />
                                  <input type="hidden" name="item_name" value="Trujillo Language Centre" />
                                  <input type="hidden" name="amount" />
                                  <input type="hidden" name="no_shipping" value="2" />
                                  <input type="hidden" name="return" value="http://www.yourwebsite.com/thankyou.html" />
                                  <input type="hidden" name="cancel_return" value="http://www.yourwebsite.com/cancel.html" />
                                  <input type="hidden" name="shopping_url" value="http://www.yourwebsite.com/your_page.html" />
                                  
                                  <input type="hidden" name="bn" value="PP-ShopCartBF:x-click-but22.gif:NonHosted" /></td>
                                </tr>
                              </table>
                            </form></td>
                          </tr>
                        </table>
                      
                      <p class="homewording">&nbsp; </p></td>
                    </tr>
                  </table></td>
                </tr>
            </table></td>
            </tr>
          </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><img src="images/bottomstrip.jpg" width="1053" height="7" /></td>
  </tr>
  <tr>
    <td><table width="150" border="0" cellpadding="0" cellspacing="0" class="greybox">
      <tr>
        <td align="center"><table width="970" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td align="right" class="copyright">© Trujillo Language Centre 2009 |<a href="terms.html" class="small"> Terms &amp; Conditions</a> |<a href="http://www.brighteyesdesign.co.uk" class="small"> design: brighteyes</a></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table><script type="text/javascript">
<!--
swfobject.registerObject("FlashID");
//-->
</script>
</body>
</html>

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Hey there is a small mistake in your code

inside the function CalculateOrde(form) {
your last condition is as below where you have given a set of conditions for else. This should not happen the else should not have any condition given change it to "else if". This will fix your issue. I tested it.

else(radG1 == "Everyday Spanish Plus (Intermediate)" && radG2 =="Breakfast, dinner and single room")
 {
 document.myform.amount.value = '515.00';
 }  


change the above else to
else if(radG1 == "Everyday Spanish Plus (Intermediate)" && radG2 =="Breakfast, dinner and single room")

Now your paypal will reflect the correct amount

Author

Commented:
Perfect, thanks!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial