I Own a website for posting forums like questions and answers with a database. I want to hardeen my code to prevent both XSS and SQl injection..
for XSS I used the folloinf function : Strip_tags htmlspecialchars htmlentities
My question is: what is the difference between them ?? Also, I face a problem with them which is : 1- I have a textarea and text boxes with default text 2- when using the above functions and I entered any test in the text area.. the output will not take what I wrote in the textarea.. it will always take the default value...
this is what I did
$first_name = $_POST['first_name'];
$first_name = htmlspecialchars($first_name);
echo $first_name
also, any one has any idea about preventing from SQL injection, I have no idea about it ..