我有一个动态获取复选框名称的表单.有没有办法找出未知变量的名称?例如:
foreach($value as $option){
$html .= "<input type='checkbox' name='".$key."[]' value='$option'>".htmlspecialchars($option)."</input>";
}
Run Code Online (Sandbox Code Playgroud)
我需要知道它_POST['']
会是什么.
使用预定义变量$ _POST并循环:
foreach($_POST as $key => $value)
{
// $key will be the name
// $value will be the value of $_POST[$key]
}
Run Code Online (Sandbox Code Playgroud)