PHP Sanitize For Contact Form
Posted: Wed Jan 28, 2009 8:07 pm
Anyone have a good tutorial on using the built in php filtering functions for an email contact form in php? I've been playing around with it but am running into problems. To validate their email address, works just fine. I'm trying to sanitize their name, subject and message using something like clears $name.
I know I'm making a dumb mistake, but I'm not sure what it is. Thanks!
Code: Select all
filter_var($_POST["email"], FILTER_VALIDATE_EMAIL)Code: Select all
$name = filter_input(INPUT_POST, $_POST["name"], FILTER_SANITIZE_STRING);I know I'm making a dumb mistake, but I'm not sure what it is. Thanks!