Menu design problem ( temperature page + menu)

Your logic appears off as well as what you are defining as a button press. Inside loop(), you read selectButton and then act upon it if it is HIGH. This demands there is an external pull-down resistor tied to that pin. Is the resistor present?

Then, inside buttonaction(), you test for selectButton being LOW

  if (!digitalRead(selectButton)) {

in order to do the executeaction() function.

So, follow the logic of the code.

  1. you press the selectButton, the state is not equal to the last state so you call buttonaction(). That function executes once and returns.
  2. you update lastbuttonState3
  3. you execute loop() again.
  4. buttonState3 is now equal to lastbuttonState3 so the else part gets executed which is sensorpage()

First off, how are your buttons wired up? This will dictate if they are HIGH or LOW when pressed. A typical schematic is one side of the button to ground and the other to the input pin with the pin declared as INPUT_PULLUP. It will read LOW when pressed.

Second, your buttonaction() function doesn't do anything if no buttons are pressed. They way you check buttons within the function needs to be the same state change detection example.

An alternative would be to use the Bounce2 library where you can define a button pin and it does all the state change and debouncing inside that library. It will make your life simplier.

Third, as I stated in reply #4, you need to keep track of what state your are in and then call the correct functions.