获取下拉菜单

发布于 2024-08-27 10:08:06 字数 900 浏览 4 评论 0原文

我使用 Paypal 的“立即购买”按钮以及用 PHP 编写的 IPN 处理程序,以便在购买时向我发送电子邮件。电子邮件已正确发送并传递了大部分数据,但它没有捕获用于选择服装尺寸的下拉列表。

这是我的按钮代码字段:

<input type="hidden" name="item_name" value="Test Shirt">
<input type="hidden" name="item_number" value="001">
<input type="hidden" name="on0" value="sizes">

Select a size:
<select name="os0">
 <option value="Small">Small </option>
 <option value="Medium">Medium </option>
 <option value="Large">Large </option>
 <option value="Extra Large">Extra Large </option>
</select>

我的 PHP IPN 脚本将数据捕获到变量中,如下所示:

$item_name = $_POST['item_name'];
$item_number = $_POST['item_number'];
$size = $_POST['on0'];
$sizeChoice = $_POST['os0'];

电子邮件正确显示项目名称和项目编号,但没有显示 $size 和 $sizeChoice 变量。已经很晚了,所以我确信我正在查看一些非常明显的东西,但我仍然想知道我是否只是调用错误或者我是否忘记了一些隐藏字段?

I'm using Paypal's buy it now buttons along with an IPN handler written in PHP to send me an e-mail whenever a purchase is made. The e-mail is properly being sent and is passing much of the data, but it's not capturing the drop down list for selecting a clothing item's size.

Here's my button code fields:

<input type="hidden" name="item_name" value="Test Shirt">
<input type="hidden" name="item_number" value="001">
<input type="hidden" name="on0" value="sizes">

Select a size:
<select name="os0">
 <option value="Small">Small </option>
 <option value="Medium">Medium </option>
 <option value="Large">Large </option>
 <option value="Extra Large">Extra Large </option>
</select>

My PHP IPN script that captures the data into variables looks like this:

$item_name = $_POST['item_name'];
$item_number = $_POST['item_number'];
$size = $_POST['on0'];
$sizeChoice = $_POST['os0'];

The e-mail properly displays the item name and item number, but nothing for the $size and $sizeChoice variables. It's late so I'm sure I'm looking over something very obvious but am still wondering if I'm just calling it wrong or if I'm forgetting some hidden fields?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

ま昔日黯然 2024-09-03 10:08:06

今天也有同样的问题。不要使用 $_POST['os0'] 和 $_POST['on0'],而是使用 $_POST['option_selection1'] 和 $_POST['option_name1']

此页面显示选项,搜索“option_name1”:
获取下拉菜单

Had the same probelm today. Instead of using $_POST['os0'] and $_POST['on0'], use $_POST['option_selection1'] and $_POST['option_name1']

This page shows the options, search for "option_name1":
Getting drop down menu

酒几许 2024-09-03 10:08:06

变量名称区分大小写。使用 $_POST 而不是 $_post。

Variable names are case sensitive. Use $_POST instead of $_post.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文