Created
July 26, 2016 14:46
-
-
Save calebcgates/45e6c06352db1f1e2e0d4c6370ae7bc6 to your computer and use it in GitHub Desktop.
PHP test_input
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// define variables and set to empty values | |
$name = $email = $gender = $comment = $website = ""; | |
if ($_SERVER["REQUEST_METHOD"] == "POST") { | |
$name = test_input($_POST["name"]); | |
$email = test_input($_POST["email"]); | |
$website = test_input($_POST["website"]); | |
$comment = test_input($_POST["comment"]); | |
$gender = test_input($_POST["gender"]); | |
} | |
function test_input($data) { | |
$data = trim($data); | |
$data = stripslashes($data); | |
$data = htmlspecialchars($data); | |
return $data; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
here is a long way in solving it also.