init(); $wp->parse_request(); $wp->query_posts(); $wp->register_globals(); // Assign current post ID as variable $current_post = $_POST['post_id']; // Remove post_id from $_POST if (array_key_exists('post_id', $_POST)) { unset($_POST['post_id']); } // Set up new array $chosen_ans = array(); $i = 1; foreach ($_POST as $id => $value) { // Add chosen answers into new array $chosen_ans[$i] = $value; $i++; } /** * Master array; multidimensional; * This array stores the meta_key, question and answers stored in WP-Admin, * the user's submitted answer and the comparison result. * * Structure: * * - meta_key [str] ( e.g. "module_0_questions_3_question" [ 0 = First Repeater, 3 = 3rd Question] ) * - - question [str] ( e.g. "How clean is your house?" ) * - - correct [bool(int)] ( e.g. 0 = False, 1 = True ) * - - chosen [bool(int)] ( See above ) * - - result [str] ( e.g. "match" if their answer is correct, "no match" if not ) * * @var array */ $q_and_a = array(); /** PARENT REPEATER **/ // check for rows (parent repeater) if( get_field('module',$current_post) ): ?> get_row($sql,OBJECT); ?> values ?> meta_key] = array( 'question' => $question, 'correct' => $correct_answer, 'chosen' => $chosen_answer, 'result' => $result ); ?>