
June 15th, 2000, 10:40 AM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
A few days ago I posed the question about building a required validation set, to check for empty required fields, and to reject those fields should they be empty..
I received a number of responses, and below is what I finally came to bringing into play.
In short we build an array of those fields which are "empty" and then loop through them, displaying each empty field, without processing the database entry.
Just thought I'd share this tid bit of code, if anyone else has been looking for a way to accomplish this task.
Now all I need to do is assemble an email address validation set, and I'm in business..
Time to play with the EREG functions of PHP URL
//insert validation code here, to valid incoming data before inserting records.
if (!$city) { $missing[] = "City"; }
if (!$state_id) { $missing[] = "State"; }
if (!$zip) { $missing[] = "Zip"; }
if (!$name) { $missing[] = "Name"; }
if (!$address) {$missing[] = "Address"; }
if (!$isp_email) {$missing[] = "ISP Email"; }
if (!$phone_1) {$missing[] = "Phone1"; }
if ($missing) {
for ($i=0; $i < count($missing); $i++) {
echo "<li>".$missing[$i]."</li>n";
}
exit;
}
------------------
SnR Graphics,
Low Cost Hosting and Web Development.
[This message has been edited by Robert_J_Sherman (edited June 15, 2000).]
|