Hello! This is my first post on here.
I will begin with saying ChronoForms is a lovely component. Very easy to understand and set up!
So to my question:
I've this code set up:
I want 4 fields to be filled and to be warned if not filled. If I fill in the 4 fields in question, I still get the message saying all marked fields need to be filled.
What have I missed?
Thanks
I will begin with saying ChronoForms is a lovely component. Very easy to understand and set up!
So to my question:
I've this code set up:
<?php
// delete all non allowed parameters
$allowed_vars = array('Etternavn', 'Fornavn', 'Mobil', 'E-postadresse');
foreach (array_keys($_POST) as $var) {
if (! in_array($var, $allowed_vars)) {
unset($_POST[$var]);
}
}
// validate: not empty
foreach ($allowed_vars as $var) {
if (empty($_POST[$var])) {
return 'Alle obligatoriske felt må fylles inn.';
}
}
// return nothing to mark submitted values as valid
?>
I want 4 fields to be filled and to be warned if not filled. If I fill in the 4 fields in question, I still get the message saying all marked fields need to be filled.
What have I missed?
Thanks