This tutorial is showing some functions that
you need to use for your taking data from a user (text field, text area) since
it is not secure to receive a string data and input them directly into your
Some special characters as ", ' , \ may be stop your SQL commands or damage your database structure and as the gateway for hackers to hack your website.
Returns a string with backslashes before characters that need to be quoted in database queries etc.
echo"Actual string is:".$str;
echo"<br/> After adding slash it become:".addslashes($str);
echo"<br/>We can break line as follows:".nl2br("This is the \n 14th day of November");
echo"<br/>After removing the slash the sting we will become<br/>";
Actual string is:rose'india
After adding slash it become:rose\'india
We can break line as follows:This is the
14th day of November
After removing the slash the sting we will become
We have 1000s of tutorials on our website. Search Tutorials tutorials on our website.
Posted on: November 19, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles