How to check if a form has been submitted in PHP

Опубликовано: 01 Март 2020
на канале: Dave Hollingworth
3,791
54

PHP for Beginners course: ➤ https://davehollingworth.net/phpy
PHP MVC course: ► https://davehollingworth.net/phpmvcy

If you have a short PHP script that contains a form, and you want to process that form in the same script, then you need to detect whether the form has been submitted or not.

In this video we'll look at how NOT to do it (even though there's lots of code out there that does it the wrong way) and the recommended way.

Code shown in the video:
https://gist.github.com/daveh/ff121a0...

Documentation shown in the video:
PHP $_POST:
https://www.php.net/manual/en/reserve...

PHP $_SERVER:
https://www.php.net/manual/en/reserve...