Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/231.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 回显函数值赢得';不要传表格_Php_Wordpress_Forms_Echo_Payment Gateway - Fatal编程技术网

Php 回显函数值赢得';不要传表格

Php 回显函数值赢得';不要传表格,php,wordpress,forms,echo,payment-gateway,Php,Wordpress,Forms,Echo,Payment Gateway,----更新:尝试找到不同的解决方案------- 我正试图在一个带有支付网关的商店平台上发布一个带有隐藏值的表单来接收这些值。 值名称“Order_Total”使用名为“$sum”的php echo显示要支付的金额,如下所示: <Input type="hidden" name="sum" value="<?php echo $order_total; ?>"> function left_to_pay_for_order($oid) { global $wpd

----更新:尝试找到不同的解决方案------- 我正试图在一个带有支付网关的商店平台上发布一个带有隐藏值的表单来接收这些值。 值名称“Order_Total”使用名为“$sum”的php echo显示要支付的金额,如下所示:

<Input type="hidden" name="sum" value="<?php echo $order_total; ?>"> 
function left_to_pay_for_order($oid)
{


global $wpdb;
    $s = "select * from ".$wpdb->prefix."order_contents where orderid='$oid' and paid='0'";
    $r = $wpdb->get_results($s);
    $total = 0;
    if(count($r) > 0)
    {
        foreach ($r as $row)
        {
            $total += $row->price * $row->quant;    
            $shp = get_post_meta($row->pid, 'shipping', true)* $row->quant;
            $total += $shp;
        }

    }

return $total;
}
该函数的工作原理如下:

<Input type="hidden" name="sum" value="<?php echo $order_total; ?>"> 
function left_to_pay_for_order($oid)
{


global $wpdb;
    $s = "select * from ".$wpdb->prefix."order_contents where orderid='$oid' and paid='0'";
    $r = $wpdb->get_results($s);
    $total = 0;
    if(count($r) > 0)
    {
        foreach ($r as $row)
        {
            $total += $row->price * $row->quant;    
            $shp = get_post_meta($row->pid, 'shipping', true)* $row->quant;
            $total += $shp;
        }

    }

return $total;
}
支付网关接收除$order_总值以外的所有其他值

更新-------------------------------- 作为“0”传递的值-对此有何想法?

在发送表单和重定向之前,我已经进行了测试,该函数可以正常工作,在发送之前,根据任何HTML上的预期结果显示总和,但表单发送值为“0”。

我做错了什么?我到处都找遍了。非常感谢你的帮助

谢谢

根据要求,这里是整个表单页面代码-根据StackOverflow修改:

    <?php

    global $wp_query, $wpdb, $current_user;

    get_currentuserinfo();
    $uid = $current_user->ID;
    $user_email = $current_user->user_email;

    $business = get_option('Theme_tranzilla_ID');
    if(empty($business)) die('ERROR. Please input your tranzilla ID.');
    //-------------------------------------------------------------------------
    $oid = $_GET['oid'];    
    $order_total = Theme_left_to_pay_for_order($oid);
    $title_post = sprintf(__('Order Payment ID #: %s','Walleto'), $oid);


    //---------------------------------


    $tm             = current_time('timestamp',0);
    $cancel_url     = get_bloginfo("siteurl");
    $response_url   = get_bloginfo('siteurl').'/?w_action=tranzila_order_response';
    $ccnt_url       = Theme_my_account_link();
    $currency       = get_option('Theme_currency');

?>


<html>
<head><title>Processing Tranzilla Payment...</title></head>
<body onLoad="document.form_mb.submit();">
<center><h3><?php _e('Please wait, your order is being processed...', 'Theme'); ?></h3></center>

<FORM name="form_mb" Action='https://direct.tranzila.com/Terminal_Name/' method='POST'>
<Input type="hidden" name="supplier" value="<?php echo get_option('Theme_tranzilla_ID') ?>"> 
<Input type="hidden" name="sum" value="<?php echo $order_total; ?>"> 
<Input type="hidden" name="currency" value="1"> 
<input type="hidden" name="email" value="<?php echo $user_email; ?>">

</FORM>




</body>
</html>

正在处理Tranzilla付款。。。

请告诉我们你在“检查”中看到了什么。。post前输入的值是多少

但是。。根据你提供的信息,我认为:

1) You are missing a ; in the end of "echo $order_total" line. Put a ; in the end.
2) It can be some wordpress conflict with the "sum" field name. Try to change to "order_total".

我认为你需要使用ajax来获得你想要的PHP正确地在HTML中打印一个值吗?那一行在HTML中是什么样子的?调试函数!对函数中的所有变量使用
var\u dump()
,直到找到错误。谢谢@JAL!如果我正确理解您的意思,那么这一行是一个动态数值,可以在HTML中正确显示。但是没有在表单post上传递。@user2777324我想这是wordpress的问题。对于输入,已经修复了上面的示例代码。我无法将输入字段名“sum”更改为其他名称,表单将发送到另一个页面,其中“sum”字段的值应大于0。你知道wordpress中有这样的冲突吗?谢谢我不知道确切情况,但有可能。。。我只是想“开箱即用”来帮你。你能查一下那里的美元邮局吗?总数为空,“或者它只是不在帖子上?谢谢@Tiago。它是“0”。