encodeme
asked on
Clean up registration and login names etc before inputting in mysql
Hi,
I am trying to clean up my html form inputs before they hit mysql.
Is this possible as I've shown below? (It's not currently working?)
If it will work have I missed anything?
Thanks
I am trying to clean up my html form inputs before they hit mysql.
Is this possible as I've shown below? (It's not currently working?)
If it will work have I missed anything?
Thanks
$username= sanitise($_POST['username']);
function sanitise($string) {
$string = trim($string);
$string = htmlentities($string);
$string = strip_tags($string);
$string = mysqli_real_escape_string($string);
return $string;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I appreciate the code tweaks... never thought of doing it inline.
thanks