php - 将文本框内容回显到 POST 请求中不起作用

标签 php html post paypal

我正在尝试从“mcname”($custom)获取文本框内容并将其发布到“item_name”,但它没有发布任何内容?我环顾四周,但仍然找不到我的解决方案?

在我的脚本顶部,在任何 HTML 之前:

<?php 
$custom = $_post['mcname'];
?>

脚本中间的文本框、表单帖子和按钮。

<input type="text" name="mcname" id="mcname" placeholder="Enter your username here…" />
<br/>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" id="formval">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="__@gmail.com">
<input type="hidden" name="item_name" value="<?php echo $custom; ?>">
<input type="hidden" name="amount" value="$10.00">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="bn" value="PP-BuyNowBF">
<input type="hidden" name="return" value="http://__.com/upgrade" />
<input type="hidden" name="cancel_return" value="http://__.com/upgrade" />
<input type="hidden" name="notify_url" value="http://__.com/ipn/ipn.php">
<input type="hidden" name="custom" value="Iron">
<button type="submit" class="btn btn-primary" href="#" rel="tooltip" data-placement="bottom" title="Click here to continue to PayPal." ><i class="icon-shopping- cart"></i>Checkout</a>
</form>

最佳答案

POST 区分大小写,试试:

$custom = $_POST['mcname'];

关于php - 将文本框内容回显到 POST 请求中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16367097/

相关文章:

html - 将文本定位在其包含的 div 的底部

html - 将此菜单居中

php - 当数据以 JSON 格式发送时,使用 php 返回的数据

php - 在 WooCommerce 管理订单列表列中显示复合订单数据

javascript - WordPress Ajax 调用——WordPress 用户 ID

html - Flexbox 布局模式 : 5 Square (1 Large, 4 小)

php - MySQL 选择 : Find if a single value exists in an array field

json - AngularJS - $http.post 以 json 格式发送数据

Django rest framework - 在 POST 后将新创建的对象的 id 传回响应

http - Flickr API iOS 应用程序 "POST size too large!"