Switching between programing

Hello All,
I am beginner in programming. I am using pH sensor with Arduino Uno. i have successfully run pH sensor and Menu program(using Switch case). But, i am having problem while i am merging both program into one file. I want to display pH value, date, time in a real time(Main screen info) and i set a condition when i press a button from keypad shield it should jump to menu program. But it is not working.
can somebody will help me in this regard??

Here is my program:

#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,20,04);
unsigned long int avgValue;
float b;
#define SensorPin A0
int buf[10],temp;
double phaddress1=0;
byte Oldkey = 6;
byte Buttonstatus = 0;
byte Menulevel = 0;
byte Row;
byte Column;
int offset;

void setup() {
lcd.init();
lcd.backlight();
Row=0;
Column=0;

}

void loop() {
lcd.clear();
lcd.setCursor(0,0);
lcd.print("pH:");
pH();
if (Buttonstatus==0){
Menu();
}
}

void pH(){
for(int i=0;i<15;i++)
{
buf[i]=analogRead(SensorPin);
delay(10);
}
for(int i=0;i<9;i++)
{
for(int j=i+1;j<10;j++)
{
if(buf[i]>buf[j])
{
temp=buf[i];
buf[i]=buf[j];
buf[j]=temp;
}
}
}
avgValue=0;
for(int i=2;i<8;i++)
avgValue+=buf[i];
float phValue=(float)avgValue5.0/1024/6;
lcd.setCursor(3,0);
lcd.print(phValue);
phValue=3.5
phValue+offset;
digitalWrite(13, HIGH);
delay(800);
digitalWrite(13, LOW);

}

void Menu(){
switch (Menulevel){
case 0:
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Press Select Button");
lcd.setCursor(0,1);
lcd.print("to continue...");
Buttonstatus = get_key(Oldkey);
if (Buttonstatus == 0)
{
Menulevel = 1;

}

break;

case 1:
lcd.clear();
lcd.setCursor(0,0);
lcd.print("1. Date and time ");
lcd.setCursor(0,1);
lcd.print("2. pH ");
lcd.setCursor(Column,Row);
lcd.print("");
Buttonstatus = get_key(Oldkey);
if (Buttonstatus == 2)
{
while (Row <1)
{
Row++;
lcd.setCursor(Column,Row);
lcd.print("
");
break;

}

}
if (Buttonstatus == 3)
{
while (Row>0)
{
Row--;
lcd.setCursor(Column,Row);
lcd.print("*");
break;

} 

}
if (Buttonstatus == 4)
{
Menulevel = 10 + Row;
Row = 0;

}
if (Buttonstatus == 1)
{
Menulevel = 0;
Row = 0;

}
break;
}
}

Please post a complete sketch rather than just part of it

not clear how Buttonstatus gets set. looks like get_key() is used, but doesn't get called until Menu() is called. not clear what get_key() returns: button state, that a button was pressed, that a specific button was pressed

it would be more conventional to update Buttonstatus in loop(). a change in buttonstatus state (i.e. a button press) could toggle a state variable which determine whether pH() or Menu() is called in loop().

the menu would typically be at a particular level, displaying the menu level of some information. right/left buttons would affect values being displayed. menu() would be called when a button is pressed and have to be structured to keep track of the menu item being displayed and what actions to take for specific button presses

a sub-function can be used to display multiple strings on the lcd, avoiding the need for the multiple tedious lcd function duplicated throughout the code. sprintf() can be used to construct strings

and click the </> and paste code in the highlighted area

Buttonstatus means which key is press.
i set up if i press key 0 from LCD keypad Shield, it shall jump to pH() and if i press key 1 than it shall jump to Menu().
Could you please enlightened me weather i can use do...while structure in this case. Do the pH measurement normally and when i press any key, it jump to menu section.

Thanks in advanced.

Hello
can you read the posts?