Well, you could check for the required fields using JavaScript, and it would also be a good idea to check using PHP, because forms can be easily bypassed. You could probably find the JavaScript version at http://www.dynamicdrive.com. The PHP would be simple:
PHP Code:
foreach ($_POST as $k => $v) {
if ($v == '') {
echo 'Empty field: ', $k, '<br>';
$missingfield = 'true';
}
}
if ($missingfield == 'true') {
//put any bottom includes here if necessary
exit;
}
The above script would check all the fields to make sure they were filled out. If you only need certain fields filled out, you could do this:
PHP Code:
$required = array('put','required','field','names','here');
foreach ($_POST as $k => $v) {
if ($v == '' && in_array($k, $required)) {
echo 'Empty field: ', $k, '<br>';
$missingfield = 'true';
}
}
if ($missingfield == 'true') {
//put any bottom includes here if necessary
exit;
}
Tested and approved.
Bookmarks