'Nick Holden', 'AA' => 'Nick Holden', 'QX' => 'Kevin Ma', 'AC' => 'Nick Holden', 'AE' => 'Sam Tisdale', 'AG' => 'Kevin Ma' ); // Regex patterns each parameter must adhere to. $patterns = array( 'sid' => "/^\\d{7}$/", 'section' => "/^" . implode('|', array_keys($tas)) . "$/", 'assignment' => "/^hw[1-3]$/" ); $valid = true; $student_name = ''; $sid = ''; $section = ''; $assignment = ''; if ($_SERVER['REQUEST_METHOD'] == 'POST') { // Get 'sid', 'section', 'assignment' parameters. $student_name = get_param('name'); $sid = get_param('sid'); $section = get_param('section'); $assignment = get_param('assignment'); // Validate each parameter. foreach ($patterns as $paramname => $pattern) { if (!preg_match($pattern, $$paramname)) { $valid = false; } } } ?>
ERROR: you filled it out wrong!
Thanks!