<? function studentStatus() { global $config; $required_fields=array("name","address","city","postalcode","phone","email","grade","age"); $q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'"); while($r=mysql_fetch_object($q)) { foreach ($required_fields AS $req) { if(!$r->$req || $r->$req==0) { return "incomplete"; } } } //if it made it through without returning incomplete, then we must be complete return "complete"; } ?>