2013-09-23 86 views
0

我有sendfrom很奇怪的问题。要处理我使用$ _POST收到的表单中的动态vales。比特币sendfrom不处理交易

$myaccount = trim($_POST['myaccount']); 
$to_wallet = trim($_POST['to_wallet']); 
$wammount = trim($_POST['wammount']); 

我可以附和他们,我可以清楚地看到,从形式传递的所有数据

现在我将它们插入到

$message = ($bitcoin->sendfrom($myaccount, $to_wallet, $wammount)); 

我发现所有的$我的帐户,$ to_wallet正确传递,但$ wammount导致问题和代码不执行。我在形式上0.0001插入场 “wammount”里面然而,一旦这是硬编码

$myaccount = trim($_POST['myaccount']); 
$to_wallet = trim($_POST['to_wallet']); 
$wammount = 0.0001; 

和下面的一切正在运行的命令运行良好,交易处理。任何想法为什么?

$message = ($bitcoin->sendfrom($myaccount, $to_wallet, $wammount)); 
+1

'var_dump($ wammount)'显示什么? –

+0

它确实显示:string(6)“0.0001” – user974435

+1

也许它不应该是一个字符串?也许它应该是一个数字? 'floatval($ wammount);' –

回答

2

添加floatval()做什么?

$wammount = floatval(trim($_POST['wammount'])); 
+0

工作得很好:)非常感谢 – user974435