0

我知道如何编码相关的选择字段,例如产品的颜色和尺寸,但不确定如何为 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> 
4

1 回答 1

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> 
于 2013-01-30T06:34:47.587 回答