PHP从动态命名的$ _POST变量中获取值

时间:2014-02-19 17:02:22

标签: php variables post dynamic

这是我的代码。不幸的是,这会导致解析错误。谁能想到更好的方法呢?

$data = mysqli_query($link, "SELECT * FROM TreatmentTypes ORDER BY TreatmentType ASC");
while($row = $data->fetch_assoc())
{
    $str = row['TreatmentTypeID'];
    echo "<br><br><br>".$_POST['txt'.$str];
}

1 个答案:

答案 0 :(得分:3)

根据您的示例判断,您错过了row['TreatmentTypeID'];中的$,因此它应为$row['TreatmentTypeID'];