PHP Iterate through $_POST and use values by name

前端 未结 4 1457
醉酒成梦
醉酒成梦 2021-02-05 05:14

I have a form that contains a number of fields with names item1, item2, item13, item43 etc, each time those fields are different because they are populated in the form with AJAX

4条回答
  •  星月不相逢
    2021-02-05 05:53

    foreach($_POST as $key => $value)
    {
        if (strstr($key, 'item'))
        {
            $x = str_replace('item','',$key);
            inserttag($value, $x);
        }
    }
    

提交回复
热议问题