In this tutorial, we will see how to use PHP to validate the data collected from a form.
You will see how to validate various fields used in general, like text, list, checkbox, radio button and we will also see how to retain POST data, so that after the user submits the form, even if the data supplied is not valid, data is not lost.
states that after submission form data will be handled by the PHP script present in this file only.
In suggesting that users are untrusted, we imply that everything else is trusted. Users are just the most obvious untrusted source of input since they are known strangers over which we have no control.
Very first we have to create a form in html setting action “#” and method “POST” with some fields, when a user clicks on submit button all the data starts travel in URL but it will be hidden, as we set method = “POST”.
Such code can now do no harm and is safe to be displayed on a page or inside an e-mail. if quotes are escaped with a slash \ let's remove that.