php中$_post怎么用,php – 如何在$_POST []中使用变量
我需要遍歷一堆動態生成的字段,但這不起作用:
$population_density = $_POST['$current_location_id'];
我有一個頁面列表,其人口在一頁上;我需要這樣做,這樣你就可以立刻更新它們.所以我使字段名稱動態地對應于location_id.提交帖子時,我需要像這樣迭代它們,但似乎你不能把一個變量放在帖子里.
for ( $y_count = 1 ; $y_count <= $zone_height; $y_count++ ) {
for ( $x_count = 1 ; $x_count <= $zone_width; $x_count++ ) {
$result = mysql_query("SELECT * FROM locations WHERE location_zone='$zone_id' AND x_location='$x_count' AND y_location='$y_count' ");
$current_location = mysql_fetch_array( $result );
$current_location_id = $current_location['ID'];
$population_density = $_POST['$current_location_id'];
$result = mysql_query("UPDATE locations SET population_density='$population_density' WHERE ID='$current_location_id' ");
}
}
是否可以將變量放在$_POST []中?如果沒有,我該如何更新動態生成的字段?
總結
以上是生活随笔為你收集整理的php中$_post怎么用,php – 如何在$_POST []中使用变量的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 台积电宣布在德国建设合资工厂 预计投资超
- 下一篇: 80端口请求太多超时 php_apmse