Logic on a Gravity Forms redirect [closed]

If anyone runs into this problem, the answer lies in the fact that gform_confirmation is fired after gform_after_submission. The logic is correct, however, the 5th session variable was not being stored before the confirmation was sent. Therefore, no variable ever equaled ‘No’ and it failed every time.

The solution is to call the $entry in the gform_confirmation and use it below in the conditional logic:

$question6 = $entry['1'];

      if(isset($_SESSION['form'])) {
          $result = array();
          foreach($_SESSION['form'] as $row){
          $result[] = $row;
          }

      if ($result[0] === 'Yes' &&  $result[1] === 'Male' &&  $result[2] >= 65 &&  $result[3] === 'No' && $question6 === 'No'  ) {
          $confirmation = array('redirect' => esc_url(home_url('/welcome')));
      }