how to sanitize php code example
Example 1: sanitize form data php
# sanitize form data
function clean($data)
{
$data = htmlspecialchars($data);
$data = stripslashes($data);
$data = trim($data);
return $data;
}
Example 2: sanitize user input php
<?php
function sanitize($string) {
return addslashes(htmlspecialchars($string));
}
?>