3.17.181.21 |    

Navigation

Google Advertisement

Diese Funktion prüft ob benötigte Formularfelder auch ausgefüllt wurden. Die Liste der benötigten Formularfelder wird der Funktion als Array Übergeben. Fehlende Felder die noch nicht ausgefüllt wurden, werden in einer Liste zurück gegeben.

check_required_field
  1. //
  2. // $cfg['required'] = array( 'name', 'vorname', 'email', 'kommentar' );
  3. //
  4. // (array) $missing = check_required_field( $_POST );
  5. //
  6. // if ( count( $missing ) ) {
  7. //     (string) $required = implode( ", ", $missing );
  8. //     echo "ERROR: The fields \"".$required."\" are missing!";
  9. // }
  10. //
  11. // ***************************************************************
  12. // this function check if all required POSTDATA was defined...
  13.  
  14. function check_required_field( $data ) {
  15.  
  16. global $cfg;
  17. (array) $error = array();
  18.  
  19. foreach ( $cfg['required'] as $keys )
  20.     if ( !$data[$keys] ) array_push( $error, $keys );
  21. return $error;
  22.  
  23. }
  24.  
Parsed in 0.010 seconds at 60.80 KB/s

Search
 
Full text search by name and content of a snippet.

User online
There are 3 users online.

Tags Cloud

Latest snippets
str2seconds
(Bash::Function)
is_integer
(Bash::Function)
file_rotate
(Bash::Function)
confirm
(Bash::Function)
is_workingtime
(Bash::Function)
last day of last month
(Bash::Snippets)
crypt_apr1_md5
(PHP::Function)
crypt_apr1_md5
(Perl::Function)
transparent
(CSS)
rfc2822Toiso8601
(PHP::Function)