<?PHP // // Array wird über ein Formular eingelesen // 10 Felder a <input type="text" name="text[]"> // $text[] = "1"; $text[] = "2"; $text[] = ""; $text[] = "4"; $text[] = ""; $text[] = "6"; $text[] = "7"; $text[] = ""; $text[] = "9"; $text[] = "10"; // // Ab hier beginnt das Script // function debug_error($var, $val){ global $error , $fehler; if(empty($val)){ $error[$var] = "#FF0000"; //rote Farbe $fehler++; } else $error[$var] = "#000000"; //schwarze Farbe
}
for($x=0;$x<count($text);$x++){
call_user_func_array ('debug_error', array($x, $text[$x]));
}
if(isset($fehler)){
for($x=0;$x<10;$x++){
echo"<font color=\"$error[$x]\">Inputfeld " . $z = $x+1 . "</font><br>";
}
}
else{
//Alles in Ordnung - Daten abspeichern!
}
?>
|