open(); foreach ($table as $var) { if ( !empty(getpost( $var ))) { $r = getpost( $var ); /*if ( $r == "true") { $r = 1; }elseif( $r ="false")*/ $db->$var = $r; }else { $erreur[] = $var; } } if (!empty ($erreur)) { echo json_encode($erreur); }else { $db->newPlane(); } $db->close(); ?>