How to display form errors with PHP | How to handle a form with PHP | English subtitles.

How to display form errors with PHP | How to handle a form with PHP | English subtitles.


How to display form errors with PHP | How to handle a form with PHP | English subtitles.

PHP tutorial.
In this tutorial we are going to see how to structure the html form
so we can show possible validation errors.

You can read the article and download the source code from my website:
https://digitalfox-tutorials.com/tuto

If you feel like saying thanks, you can buy me a coffee.
https://www.buymeacoffee.com/digitalfoxb


Content

3.24 -> Hello guys,
5.68 -> Today we are going to see how to display form errors with php.
9.64 -> Lets see a quick demo in the browser.
31.48 -> Now lets see how this is done.
37.64 -> I have here an empty php file, where i am going to handle the form request.
44.24 -> In my index file i have the form element.
62.2 -> In this code-block i have the username's field.
100.28 -> Next i have the password field.
105.36 -> I have also a unique class name for my password field.
113.16 -> Next i have the submit button,
125.88 -> And last is the success placeholder.
128.96 -> I don't need a second class here because i have only one success element.
133.88 -> You can download the files and follow along.
137.24 -> Now lets go to the php file to do a simple validation, where i am going to check for empty input values.
227.96 -> I don't need to echo out those variables.
235.68 -> Now i have to place those variables to their places inside the html code.
275.12 -> Now i need access to the php file.
283.68 -> The last thing i have to do is to change the display property of the error element.
326.56 -> Thats all the code we need, Lets see in the browser if it works.
339.36 -> And this is the end of today's tutorial. Thanks for watching guys.

Source: https://www.youtube.com/watch?v=DG-IQhPxYRM