Avoid using isset in PHP when accessing $_POST, $_GET, and other variables?

前端 未结 6 1279
北海茫月
北海茫月 2020-12-21 07:06

how can I prevent PHP from returning an Undefined variable error every time I try to check a variable if it has contents and that certain variable hasn\'t b

6条回答
  •  时光说笑
    2020-12-21 07:35

    The variable will be always SET as long as you sent the form .

    So its better to check of the variable is not empty.

    if(!empty($_POST['var']))

提交回复
热议问题