Reading an RFID value while inside a switch structure

I’m currently working on a project which contains multiple switch cases based on user input from a matrix keypad. In one of the cases, I need to retreive the RFID value of the tag that is flashed. The main difference of this particular switch case over the other ones is that the board needs to keep scanning the reader until an input is produced(I’ve used a softwareserial.available() to wait for the input. But for some reason, my arduino does not wait for the RF input and proceeds to the block where it has to wait for the next keypad input.

[code]case '5':    //Buzzer LF
          for(int i=0;i<5;i++)
           {
               digitalWrite(buz,HIGH);
               delay(7000);
               digitalWrite(buz,LOW);
               delay(7000);
           }
          break;
    
    case '6':           //LOCKING SYSTEM RF
           lcd.clear();
           lcd.setCursor(0,0);
           lcd.print("FLASH TAG");
           checkrf();
           break;

[/code]

The checkrf() function is as follows:

void checkrf()
{
  while(1)
           {
              for(count=0;count<12;count++)
              {
              input[count] = rfid_reader.read();            
              }
              lcd.clear();
              lcd.setCursor(0,0);
              lcd.print("LOOP");
                flag = 0;
                count = 0; // Reset the counter to zero
                while(rfid_reader.available() && count < 12) // Keep reading Byte by Byte from the Buffer till the RFID Reader Buffer is empty or till 12 Bytes (the ID size of our Tag) is read
                {
                    input[count] = rfid_reader.read(); // Read 1 Byte of data and store it in the input[] variable
                    count++; // increment counter
                    delay(5);
                }
                for(count=0;count<12;count++)
                {
                   if(input[count]==admin[count] || input[count]==child[count])
                   {
                     flag=1;
                   }
                }
                if(flag==1)
                {
                  lcd.clear();
                  lcd.setCursor(0,0);
                  lcd.print("ACCESS GRANTED");
                  break;
                }
                else
                {
                  lcd.clear();
                  lcd.setCursor(0,0);
                  lcd.print("ACCESS DENIED");
                  break;
                }
           }
}

Also pls note that the main switch case is inside a loop defined inside a Wire.onReceive() block because the input is coming from another arduino.

Thanks

Why did you not post all your code.

Did you read the how to use this forum sticky post? Also read the one with the title:-
Read this before posting a programming question