Using if(isset($_POST['submit'])) to not display echo when script is open is not working

后端 未结 7 614
走了就别回头了
走了就别回头了 2020-11-28 14:50

I have a little problem with my if(isset($_POST[\'submit\'])) code. What I want is some echos and a table to not appear when the script is open but I do want it

7条回答
  •  广开言路
    2020-11-28 15:14

    You never named your submit button, so as far as the form is concerned it's just an action.

    Either:

    1. Name the submit button ()
    2. Test if (!empty($_POST)) instead to detect when data has been posted.

    Remember that keys in the $_POST superglobal only appear for named input elements. So, unless the element has the name attribute, it won't come through to $_POST (or $_GET/$_REQUEST)

提交回复
热议问题