I've used html, css, javascript, and jQuery validation and I think I'm ready to load variables in php. My webpage has about 300 elements (20 text(area)s, 40 radio, and 250 check-boxes with only a few that are required.
I found this code for php validation and have 3 newbie questions:
<?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;
}
?>
1- Have I left out any important steps?
2- Do only text(area)s need this kind of server validation or do I need to do this for the radio and checkboxes?
3- Can null elements go through this cleaning process or do I have to test for and exclude null elements first?
Thanks, Dan