更新时间:2023-01-16 22:33:59
首先,你可能想使用 爆
,而不是爆炸,来构建你的 $ toField
变量; - )
First, you probably want to use implode
, and not explode, to construct your $toField
variable ;-)
$ids = array(24, 25, 26, 29);
$toField = implode(',', $ids);
var_dump($toField);
这将使你
string '24,25,26,29' (length=11)
您在随后的形式注入这一点;这样的事情可能会做:
You then inject this in the form ; something like this would probably do :
<input type="hidden" value="<?php echo $toField; ?>">
的(再检查一下你的表单的HTML源代码,以确保;-))的
结果
然后,当它被提交从表单接收数据的PHP脚本,你会使用 爆炸
来提取数据作为一个数组,从字符串:
Then, on the PHP script that receives the data from the form when it's been submitted, you'd use explode
to extract the data as an array, from the string :
foreach (explode(',', $_POST['receiverID']) as $receiverID) {
var_dump($receiverID);
}
这将让你:
string '24' (length=2)
string '25' (length=2)
string '26' (length=2)
string '29' (length=2)
和,现在,你可以使用IDS放入系统...
And, now, you can use thoses ids...