Code has been added to clipboard!
Use of PHP Form Validation
Example
<?php
// define variables and set to empty values
$nickname = $anon = $feedback = '';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$nickname = test_input($_POST['nickname']);
$feedback = test_input($_POST['feedback']);
$anon = test_input($_POST['anon']);
}
function proc_input($input) {
$input = trim($input);
$input = stripslashes($input);
$input = htmlspecialchars($input);
return $input;
}
?>