Interger values changing.

I am relatively new to programming in C++, so the solution to this problem may be obvious to most, but I can't make sense of it.
The intent of the program is to obtain the start time of an event occurring when an input transitions from low to high. Acquiring the start time is to be done only once at each low to high transition. The program does not work because apparently two integers (BurnerOn and lastBurnerOn are changing value when the sketch execution transitions from the end of the loop to the beginning of the loop (high at the end of the loop and low at the beginning without any code to cause the change between those two points). I am sure there is a very simple explanation for this - can anyone help?
I have placed Serial.print commands at the end of the loop and the beginning of the loop to test what is going on. The following shows the readout of the serial monitor:
BurnerOn1=0 lastBurnerOn1=0 lastBurnerOn2=1 BurnerOn2=1

[[code]
//OVEN DIAGNOSTIC 
//Test program to acquire start time only once when input "BurnerOn" transistions from low to high.
 unsigned long BurnerStartT=0;
 unsigned long CurrentT=0;
 int BurnerOn;
 int lastBurnerOn;
 int Enable=0;
int x=0;

void setup(){
  
pinMode (11, INPUT);
pinMode (10, INPUT_PULLUP);
pinMode (53, OUTPUT);
Serial.begin(9600);
}

void loop() 

{
 
  unsigned long BurnerStartT;
  int BurnerOn;
  int lastBurnerOn;
  unsigned long CurrentT;
  int Enable;
  int Reset;

Serial.print ("BurnerOn1=");//Here, BurnerOn and lastBurnerOn are both low after being high at the end of the loop function.
Serial.print (BurnerOn); 
Serial.print ("  ");
Serial.print ("lastBurnerOn1=");
Serial.print (lastBurnerOn);
Serial.print ("  ");

  Reset=digitalRead(10);
  BurnerOn=digitalRead(11);

  if((BurnerOn != lastBurnerOn) && (BurnerOn==1)) { //Input transition from low to high calls GetStartTime function which returns the start time.
 BurnerStartT=GetStartTime();
      }
 CurrentT=millis();     
  if (((BurnerOn==HIGH) && (CurrentT-BurnerStartT>=800)) || ((Enable==1) && (Reset==HIGH))) {
    Enable=1;
    digitalWrite (53, HIGH);
  }
  else {
    Enable=0;
    digitalWrite (53, LOW);
  }
  
lastBurnerOn=BurnerOn;

Serial.print ("lastBurnerOn2="); //Both intergers high here after the input is high.
Serial.print (lastBurnerOn);
Serial.print ("  ");
Serial.print ("BurnerOn2=");
Serial.print (BurnerOn);
Serial.println ("  ");

delay (3000);
}

unsigned long GetStartTime() {
  unsigned long x=millis();
  return x;
}

[/code]
[/code]

Should also mention that the input is high during the monitor capture.

you are redeclaring in the loop some of your variables

  unsigned long BurnerStartT;
  int BurnerOn;
  int lastBurnerOn;

(Enable too)
so they become local variables instead of global ones and will get forgotten at next loop

==> read about variable scope

why do you slow down your program with a GetStartTime() function that is just millis()? just use millis() in the code…

Thank you so much. That was exactly the problem.