Simpler way to validate form fields? [message #179786] |
Tue, 04 December 2012 22:37 |
Gilles Ganault
Messages: 27 Registered: September 2010
Karma:
|
Junior Member |
|
|
Hello
If this the best way to validate each and every field in a form, or is
there a better/simpler way?
http://phpmaster.com/form-validation-with-php/
(section "Validating the Form Contents")
Sample:
========
$nameErr = $addrErr = "";
$name = $address "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (empty($_POST["name"])) {
$nameErr = "Missing";
}
else {
$name = $_POST["name"];
}
etc.
========
Thank you.
|
|
|