test_input - , , PHP. , , , , , test_input.
http://www.w3schools.com/php/php_form_validation.asp , test_input,
<?php
$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;
}
?>
, , , , , .
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
echo 'posted';
if (empty($_POST["comment"]))
{
$comment = "";
}
else
{
$comment = add_date($_POST["comment"]);
}
}
function add_date($comment)
{
return $comment . date('d-m-Y G:i:s');
}
, Hello this is a comment, $comment Hello this is a comment 28-11-2014 16:00:00
, , test_input - , w3schools, , - ..