Return to Snippet

Revision: 47592
at June 10, 2011 22:57 by nebojsac

Initial Code
function sanitize($data)
	$data = trim($data); 
		$data = stripslashes($data);
	$data = mysql_real_escape_string($data);
	return $data;

$username = sanitize($_POST['username']);

Initial URL

Initial Description
The function returns the "sanitized" version of user input. Use before putting variables into SQL code.

Initial Title
Sanitize user input PHP

Initial Tags
mysql, php, function

Initial Language