有没有办法在不知道名字的情况下找出POST变量? [英] Is there a way to find out POST variables without knowing their names?

查看:101
本文介绍了有没有办法在不知道名字的情况下找出POST变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表格可以动态获取复选框的名称。有没有办法找出未知变量的名字?例如:

I have a form that gets its names for checkboxes dynamically. Is there a way to find out the names of the unknown variables? For example:

 foreach($value as $option){
            $html .= "<input type='checkbox' name='".$key."[]' value='$option'>".htmlspecialchars($option)."</input>";
    }

我需要知道 _POST ['' ] 会是。

推荐答案

使用预定义变量 $ _ POST 并循环:

Use the predefined variable $_POST and loop over :

foreach($_POST as $key => $value)
{
    // $key will be the name
    // $value will be the value of $_POST[$key]
}

这篇关于有没有办法在不知道名字的情况下找出POST变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆