Paypal add product?

Associate
Joined
17 Mar 2004
Posts
1,562
Trying to add a form to my website, where people can select a product from a drop down list and then next it to the price will appear. They can then click the paypal button and it will go through to the paypal checkout with the amount.

Heres what I have so far.

<form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="########">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="item_name" value="Product">
<table>
<tr>
<td width="100px">
<input type="hidden" name="on0" value="Product"><strong>Product:</strong></td>
<td>
<select name="os0">
<option value="Select a Product">Select a Product:
<option type="text" name="amount" value="93.00">Hosting
<option type="text" name="amount" value="47.00">.com Domain
</select></td>

<td><input type="text" name="amount" value="13.50"></td>

<td><input type="image" src="http://www.paypal.com/en_US/i/btn/x-click-but01.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"></td>
</tr>
</table>
</form>


Cheers for any help!
 
If I understand you correctly, you wanted the page to auto-change the text box depending on what was selected from the dropdown box? Try this, should work okay:
<script language="javascript">
function changeAmount()
{
theForm = document.forms._xclick;
theAmount = theForm.os0.options[theForm.os0.selectedIndex].value;
theForm.amount.value = theAmount;
}
</script>


<form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="########">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="item_name" value="Product">
<table>
<tr>
<td width="100px">
<input type="hidden" name="on0" value="Product"><strong>Product:</strong></td>
<td>
<select name="os0" onChange="changeAmount()">
<option value="Select a Product">Select a Product:
<option type="text" name="amount" value="93.00">Hosting
<option type="text" name="amount" value="47.00">.com Domain
</select></td>

<td><input type="text" name="amount" value="13.50"></td>

<td><input type="image" src="http://www.paypal.com/en_US/i/btn/x-click-but01.gif"

border="0" name="submit" alt="Make payments with PayPal - it's fast, free and

secure!"></td>
</tr>
</table>
</form>
I'm sure it can be done a little prettier but it works :p
 
Back
Top Bottom