how to check multiple $_POST variable for existence using isset()?

前端 未结 9 847
隐瞒了意图╮
隐瞒了意图╮ 2020-12-18 05:17

I need to check if $_POST variables exist using single statement isset.

if (isset$_POST[\'name\']  &&  isset$_POST[\'number\']  &&am         


        
9条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-18 06:09

    Old post but always useful

    foreach ($_POST as $key => $val){
    $$key = isset($_POST[$key]) ? $_POST[$key] : '';
    }
    

提交回复
热议问题