Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 可能吗?!为paypal动态下拉菜单项提供动态名称_Php_Sql_Dynamic_Drop Down Menu_Paypal - Fatal编程技术网

Php 可能吗?!为paypal动态下拉菜单项提供动态名称

Php 可能吗?!为paypal动态下拉菜单项提供动态名称,php,sql,dynamic,drop-down-menu,paypal,Php,Sql,Dynamic,Drop Down Menu,Paypal,我有一个从我的数据库填充的下拉菜单。填充列表后,我必须为每个选项和选项金额提供一个条目,但它需要链接到列表。有没有办法让每个选项都有一点信息可以传递给paypal,因为目前传递给paypal购物车的唯一信息是“PHOTOID&”,但我无法让它发送所选的产品!啊!!请帮忙! 这是我的密码: <form target="_self" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <!-- Identify

我有一个从我的数据库填充的下拉菜单。填充列表后,我必须为每个选项和选项金额提供一个条目,但它需要链接到列表。有没有办法让每个选项都有一点信息可以传递给paypal,因为目前传递给paypal购物车的唯一信息是
“PHOTOID&”
,但我无法让它发送所选的产品!啊!!请帮忙! 这是我的密码:

<form target="_self" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="MYEMAILADDRESS" />
<input type="hidden" name="cancel_return" value="website/cancel">

<!-- Specify an Add to Cart button. -->
<input type="hidden" name="cmd" value="_cart" />

<input type="hidden" name="add" value="1" />
<!-- Specify details about the item that buyers will purchase. -->
<input type="hidden" name="item_name" value="PHOTOID<?php echo $pid;?> <?php echo $product;?>" />
<input type="hidden" name="currency_code" value="GBP" />


<!-- Provide a dropdown menu option field with prices. -->
<!--<input type="hidden" name="on1" value="Size" />-->

<select name="os1">
<option value="Delivery Destination">-- Select --</option>
<?php 
$i = 0;?>
<?php $prices=MYSQL_QUERY( "select * from FESTpricelist");

while($pricelist=mysql_fetch_array( $prices )) 

{
$id = "".$pricelist['id']."";
$product = "".$pricelist['product'].""; 
$price = "".$pricelist['price']."";
?>

<option value="<?php echo $product;?>"><?php echo $product;?> £<?php echo $price;?> </option>

<?php } ?>

</select>

<br />

<!-- Specify the price that PayPal uses for each option. -->
<input type="hidden" name="option_index" value="1" />
<?php 
$i = 0;?>
<?php $prices=MYSQL_QUERY( "select * from FESTpricelist");

while($pricelist=mysql_fetch_array( $prices )) 

{
$id = "".$pricelist['id']."";
$product = "".$pricelist['product'].""; 
$price = "".$pricelist['price']."";
?>

<input type="hidden" name="option_select<?php echo $i;?>" value="<?php echo $product;?>" />
<input type="hidden" name="option_amount<?php echo $i;?>" value="<?php echo $price; ?>" />
<?php $i = $i + 1;
} ?>

<!-- specify shipping cost -->
<input type="hidden" name="shipping1" value="0" />

<!-- Display the payment button. 
<input type="image" name="submit" border="0" src="https://www.paypal.com/en_US/i/btn/btn_cart_LG.gif" alt="PayPal - The safer, easier way to pay online" />-->
<input type="image" src="images/1301261203_edit_add.png" border="0" name="submit" alt="PayPal - The safer, easier way to pay online.">

<img alt="paypal" border="0" width="1" height="1" src="https://www.paypal.com/en_US/i/scr/pixel.gif">
</form>

我知道了!!!:)


函数updateItemName(){
var select=document.getElementById('select_stuff');
var field=document.getElementById('item_name');
field.value=select.options[select.selectedIndex].value;
};
材料1
材料2
我找到了!!!:)


函数updateItemName(){
var select=document.getElementById('select_stuff');
var field=document.getElementById('item_name');
field.value=select.options[select.selectedIndex].value;
};
材料1
材料2
只需在值中添加一个“PHOTOID”。所以当Stuff 1点击时,它会更新为“PHOTOID2 Stuff 1”!field.value=“PHOTOID”+select.options[select.selectedIndex].value;只需再做一件事,将“PHOTOID”添加到值中。所以当Stuff 1点击时,它会更新为“PHOTOID2 Stuff 1”!field.value=“PHOTOID”+select.options[select.selectedIndex].value;
<script type="text/javascript">
function updateItemName() {
  var select = document.getElementById('select_stuff');
  var field = document.getElementById('item_name');

  field.value = select.options[select.selectedIndex].value;
};
</script>

<input type="hidden" name="item_name" id="item_name" value="" />

<select name="select_stuff" id="select_stuff" onchange="updateItemName()">
  <option value="Stuff 1" >Stuff 1</option>
  <option value="Stuff 2">Stuff 2</option>
</select>