PHP form - on submit stay on same page

后端 未结 9 940
醉梦人生
醉梦人生 2020-11-29 01:49

I have a PHP form that is located on file contact.html.

The form is processed from file processForm.php.

When a user fills out the

9条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-29 02:11

    What I do is I want the page to stay after submit when there are errors...So I want the page to be reloaded :

    ($_SERVER["PHP_SELF"])
    

    While I include the sript from a seperate file e.g

    include_once "test.php";
    

    I also read somewhere that

    if(isset($_POST['submit']))
    

    Is a beginners old fasion way of posting a form, and

    if ($_SERVER['REQUEST_METHOD'] == 'POST')
    

    Should be used (Not my words, read it somewhere)

提交回复
热议问题