“So what exactly do we mean by data validation and why is it so
important? Validating data becomes important when your application
starts to accept user input. The rule of thumb is not to trust any
data that comes from outside your application i.e. from forms or
through the browser. While any data that originate from within your
application is ‘safe’. Any data that comes from outside needs to be
‘sanitized’ before it is accepted into your application. Example of
‘safe’ data is:$myvar = “A safe variable”;
“The code above contains a variable that is defined within your
application and can therefore be trusted. While the following data
cannot be trusted:$user = $_POST[‘username’];
$ID = $_GET[‘id’];”
Data Filtering with PHP
By
Get the Free Newsletter!
Subscribe to Developer Insider for top news, trends, & analysis