我的代码是:
POST 的 HTML 部分:
<form action='key.php' method='POST'>
<input type='number' name='consumervar[]' value='512'/>
<input type='number' name='consumervar[]' value='256'/>
<input type='number' name='consumervar[]' value='1024'/>
<input type='submit'/>
</form>
key.php 的 PHP 代码:
<?PHP
foreach ($_POST as $key => $value) {
$consumervar = $value*64;
}
print_r($consumervar); // this is for for debug (see array contents)
?>
但是当我运行它重现的所有内容时:
Fatal error: Unsupported operand types in /var/blahblah/blahblah/key.php on line 3
请帮忙。如何正确执行?它需要将每个发布的值乘以整数 64。