PHP 计数函数不适用于文本框数组


php count function not working with textbox array

我想计算下一页中出现在一页中的文本框数组的数量。在第一页中,我将文本框数组设置为

echo "< input name=t1 [] type=hidden value=$row[ad_id] />";

这里出现了 25 个文本框数组。

在下一页中,我正在访问它

$AID = $_POST['t1'];
$limit = count($t1);

$limit变量将值显示为 0,但在第一页中出现了 25 个文本框数组。问题出在哪里?

尝试使用这个,因为$_POST['t1']是一个数组。您应该得到正确的结果:

$AID = $_POST['t1'];
$limit = count($AID);

输入名称应该像t1[]而不是t1 []

echo "< input name='t1[]' type='hidden' value='".$row[ad_id]."' />";
if(isset($_POST['t1'])){      
     $AID = $_POST['t1'];
     echo $limit = count($AID);
}