Form problem using Paypal

liunx

Guest
Hi, I am using forms to purchase items on my webpage through Paypal. I want to have a drop down menu with some options, but the options will have to change the price of the item. <br />
<br />
Paypal says on their web page that their option menu's won't change the price, but I know there has to be a way to do it. <br />
<br />
Can anybody give me any ideas. I can give you links to my page if you'll need to see it.<br />
<br />
Thanks.<!--content-->Add the link is ...<!--content-->http://www.gradwellhouse.com/buttonshy/stickerformtest.htm <br />
<br />
there's the link. basically the drop down menu tells you the changes I would like them to make, but they obviously don't change anything yet.<!--content-->Check out the changes:<br />
<br />
function ChangePrice(str) {<br />
var normal=1;<br />
if(str!="Normal") {<br />
var str=str.split("$");<br />
str=str[1].split(" ");<br />
normal+=parseInt(str[0]);<br />
}<br />
document.getElementById('cost').innerHTML="$"+normal; <br />
}<br />
<br />
<br />
<p>Sticker - Costs <span id="cost">$1.00</span></p><br />
<form name="itemlist" action="https://www.paypal.com/cgi-bin/webscr" method="post"><br />
<input type="hidden" name="cmd" value="_xclick"><br />
<input type="hidden" name="business" value="[email protected]"><br />
<input type="hidden" name="undefined_quantity" value="1"><br />
<input type="hidden" name="item_name" value="Custom Sticker"><br />
<input type="hidden" name="amount" value="1.00"><br />
<input type="hidden" name="no_note" value="1"><br />
<input type="hidden" name="currency_code" value="USD"><br />
<table><br />
<tr><br />
<td><br />
<input type="hidden" name="on0" value="Type">Type<br />
</td><br />
<td><br />
<select name="os0" onchange="ChangePrice(this.options[this.selectedIndex].value);"><br />
<option value="Normal">Normal<br />
<option value="Glossy ($1 more)">Glossy ($1 more)<br />
<option value="Reflective ($2 more)">Reflective ($2 more)<br />
<option value="Glow in the Dark($3 more)">Glow in the Dark($3 more)<br />
</select><br />
</td><br />
</tr><br />
</table><br />
<input type="image" src=http://www.webdeveloper.com/forum/archive/index.php/"x-click-but23.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!" width="68" height="23"><br />
</form><!--content-->hey Fang, Thanks so much. I tried it and the amount at the top does change, but when I get to the paypal page it is still charging $1.00 for each item. check it out.<br />
<br />
<!-- m --><a class="postlink" href="http://www.gradwellhouse.com/buttonshy/stickerformtest.htm">http://www.gradwellhouse.com/buttonshy/ ... rmtest.htm</a><!-- m --><!--content-->I expected you to have to do some more work on the form.<br />
Item name, quantity etc. Add this as the last line in function ChangePrice<br />
<br />
document.itemlist.amount.value=normal;<!--content-->yup, now it works. thanks for the tips. I really only know simple html but I'm getting there. These forums are a big help.<!--content-->another question, where should I start if I were going to alter the price in a different way? Say was $2.00 for a regular sticker. $4.00 for a glossy. $5.00 for reflective, and $10.00 for a glow in the dark one. <br />
<br />
Is it a simple change or a whole new script?<!--content-->The normal cost is changed in the function ChangePrice() the line var normal=1;<br />
The others are changed in the options where ever you see a "$" sign.<br />
If the prices are in dollars and cents ($2.50) then the script would need to be changed.<br />
Change some of the prices and see whan happens.<!--content-->so I did all this and now everything is working great and of course I have an all new question. Say I want more than one of this form on the page, I tried to copy and paste the code more than once on the page and it gave me an error?<!--content-->you can add as many as you like by giving a few tag attributes a different index (colored red)<br />
I do not know if this method would work for paypal.<br />
<br />
<script type="text/javascript"><br />
<!--<br />
function ChangePrice(str, num) {<br />
var normal=1;<br />
if(str!="Normal") {<br />
var str=str.split("$");<br />
str=str[1].split(" ");<br />
normal+=parseInt(str[0]);<br />
}<br />
document.getElementById('cost'+num).innerHTML="$"+normal; <br />
}<br />
//--><br />
</script><br />
<br />
</head><br />
<body><br />
Sticker - Costs <span id="cost1">$1.00</span></p><br />
<form name="itemlist1" action="https://www.paypal.com/cgi-bin/webscr" method="post"><br />
<input type="hidden" name="cmd" value="_xclick"><br />
<input type="hidden" name="business" value="[email protected]"><br />
<input type="hidden" name="undefined_quantity" value="1"><br />
<input type="hidden" name="item_name" value="Custom Sticker"><br />
<input type="hidden" name="amount" value="1.00"><br />
<input type="hidden" name="no_note" value="1"><br />
<input type="hidden" name="currency_code" value="USD"><br />
<table><br />
<tr><br />
<td><br />
<input type="hidden" name="on1" value="Type">Type<br />
</td><br />
<td><br />
<select name="os1" onchange="ChangePrice (this.options[this.selectedIndex].value, 1);"><br />
<option value="Normal">Normal<br />
<option value="Glossy ($1 more)">Glossy ($1 more)<br />
<option value="Reflective ($2 more)">Reflective ($2 more)<br />
<option value="Glow in the Dark($3 more)">Glow in the Dark($3 more)<br />
</select><br />
</td><br />
</tr><br />
</table><br />
<input type="image" src=http://www.webdeveloper.com/forum/archive/index.php/"x-click-but23.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!" width="68" height="23"><br />
</form><br />
Badge - Costs <span id="cost2">$1.00</span></p><br />
<form name="itemlist2" action="https://www.paypal.com/cgi-bin/webscr" method="post"><br />
<input type="hidden" name="cmd" value="_xclick"><br />
<input type="hidden" name="business" value="[email protected]"><br />
<input type="hidden" name="undefined_quantity" value="1"><br />
<input type="hidden" name="item_name" value="Custom Sticker"><br />
<input type="hidden" name="amount" value="1.00"><br />
<input type="hidden" name="no_note" value="1"><br />
<input type="hidden" name="currency_code" value="USD"><br />
<table><br />
<tr><br />
<td><br />
<input type="hidden" name="on0" value="Type">Type<br />
</td><br />
<td><br />
<select name="os0" onchange="ChangePrice (this.options[this.selectedIndex].value, 2);"><br />
<option value="Normal">Normal<br />
<option value="Glossy ($1 more)">Glossy ($1 more)<br />
<option value="Reflective ($2 more)">Reflective ($2 more)<br />
<option value="Glow in the Dark($3 more)">Glow in the Dark($3 more)<br />
</select><br />
</td><br />
</tr><br />
</table><br />
<input type="image" src=http://www.webdeveloper.com/forum/archive/index.php/"x-click-but23.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!" width="68" height="23"><br />
</form><br />
</body><!--content-->I would highly reccommend doing this kind of think serverside, or 13% or users will be paying $1 for all of your items because they don't have javascript.<!--content-->What exactly is serverside?<!--content-->A language that runs on the server, such as Perl, CGI, ASP, etc.<!--content-->
 
Back
Top