我知道如何编码相关的选择字段,例如产品的颜色和大小,但不知道如何为2种不同的产品提供2个选择字段(下拉列表)。我是否需要编写两个单独的表单?或者有没有办法将两者放在同一种形式。这里我展示了后一个选项,但没有骰子。想法?
另外,试图找出如何将空的第一个选项编码为"选择......"
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="business" value="buy@mycompany.com">
<input type="hidden" name="bn" value="MyCompany_BuyNow_Annual_US">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="add" value="1">
<input type="hidden" name="item_name" value="Annual Subscription">
<input type="hidden" name="return" value="http://www.mycompany.com"">
<input type="hidden" name="cancel_return" value="http://www.mycompany.com"">
<input type="hidden" name="currency_code" value="USD">
<p>U.S. Subscription</p>
<select name="os0">
<option value="">Select a Subscription</option>
<option value="One year">One year: $26</option>
<option value="Two years">Two years: $52</option>
</select>
<input type="hidden" name="on0" value="Length of Subscription">
<input type="hidden" name="option_select0" value="Sorry, no selection">
<input type="hidden" name="option_amount0" value="0">
<input type="hidden" name="option_select1" value="One year">
<input type="hidden" name="option_amount1" value="26.00">
<input type="hidden" name="option_select2" value="Two years">
<input type="hidden" name="option_amount2" value="52.00">
<input type="hidden" name="option_index" value="0">
<input type="submit" name="submit" class="button" value="Subscribe US">
<p>U.S. Renewals</p>
<select name="os1">
<option value="">Select a Renewal</option>
<option value="One year">One year: $26</option>
<option value="Two years">Two years: $52</option>
</select>
<input type="hidden" name="on1" value="Length of Subscription">
<input type="hidden" name="option_select0" value="Sorry, no selection">
<input type="hidden" name="option_amount0" value="0">
<input type="hidden" name="option_select1" value="One year">
<input type="hidden" name="option_amount1" value="18.00">
<input type="hidden" name="option_select2" value="Two years">
<input type="hidden" name="option_amount2" value="36.00">
<input type="hidden" name="option_index" value="0">
<input type="submit" name="submit" class="button" value="Renew US">
</form>
答案 0 :(得分:0)
有几种方法可以做到这一点,但考虑到最低限度的复杂性,我会将其编码为两种形式:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="business" value="seller_1312096880_biz@test.com">
<input type="hidden" name="bn" value="MyCompany_BuyNow_Annual_US">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="add" value="1">
<input type="hidden" name="item_name" value="Annual Subscription">
<input type="hidden" name="return" value="http://www.mycompany.com">
<input type="hidden" name="cancel_return" value="http://www.mycompany.com">
<input type="hidden" name="currency_code" value="USD">
<p>U.S. Subscription</p>
<select name="os0">
<option value="">Select a Subscription</option>
<option value="One year">One year: $26</option>
<option value="Two years">Two years: $52</option>
</select>
<input type="hidden" name="on0" value="Length of Subscription">
<input type="hidden" name="option_select0" value="Sorry, no selection">
<input type="hidden" name="option_amount0" value="0">
<input type="hidden" name="option_select1" value="One year">
<input type="hidden" name="option_amount1" value="26.00">
<input type="hidden" name="option_select2" value="Two years">
<input type="hidden" name="option_amount2" value="52.00">
<input type="hidden" name="option_index" value="0">
<input type="submit" name="submit" class="button" value="Subscribe US">
</form>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="business" value="seller_1312096880_biz@test.com">
<input type="hidden" name="bn" value="MyCompany_BuyNow_Annual_US">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="add" value="1">
<input type="hidden" name="item_name" value="Annual Renewal">
<input type="hidden" name="return" value="http://www.mycompany.com">
<input type="hidden" name="cancel_return" value="http://www.mycompany.com">
<input type="hidden" name="currency_code" value="USD">
<p>U.S. Renewals</p>
<select name="os0">
<option value="">Select a Renewal</option>
<option value="One year">One year: $18</option>
<option value="Two years">Two years: $36</option>
</select>
<input type="hidden" name="on0" value="Length of Subscription">
<input type="hidden" name="option_select0" value="Sorry, no selection">
<input type="hidden" name="option_amount0" value="0">
<input type="hidden" name="option_select1" value="One year">
<input type="hidden" name="option_amount1" value="18.00">
<input type="hidden" name="option_select2" value="Two years">
<input type="hidden" name="option_amount2" value="36.00">
<input type="hidden" name="option_index" value="0">
<input type="submit" name="submit" class="button" value="Renew US">
</form>