?php $privs = array('A', 'E', 'D', 'S', 'P', 'T'); $tables = array('evac_info', 'evac_info_prereg', 'evac_users', 'evac_news', 'Bus_Roster', 'Sex_Offenders'); $output = implode(";", $tables) . ";"; $output .= '
'; foreach($tables as $table) { foreach($privs as $priv) { if(array_key_exists($table . '_' . $priv, $_POST)) { $output .= $priv; } } $output .= ';'; } echo $output; ?>