Arduino Mega, Using a keypad and an LCD to enter info based off questions asked

Hello i am very new to coding with arduino and i am trying to set my keypad and my LCD together to ask the user to enter information based off questions asked, so i have a couple of questions here:

1: the first question asked to the user is to enter the date. i have it setup where they can enter a number and press the # to move the curser to the next position but when i finish entering the date and press the # it goes back to the initial curser position when i want it to save the date entered and move on to the next question.

2: the second question is to enter the type of object being tested. i want to set it up as to have only the 1 and 2 buttons being used. pressing the ‘1’ buttons means testing a 36" pole and the ‘2’ button being the 42" pole.

3: the third question is to enter the trial number and press # to advance.

please i would really appreciate the help im stuck, here is the code i have so far

/ Declaring libraries
#include <Keypad.h> //Library for kepad
#include <LiquidCrystal_I2C.h> //Library for the LCD display
#include <Wire.h> // Also for the LCD display

//////////////// Definitions of Adruino pins
int key; // Variable that contains the input from the keypad

//////////////// The following is using the LCD library to initialize the display
LiquidCrystal_I2C lcd(0x3F,2,1,0,4,5,6,7,3,POSITIVE); // backlight is on (positive)

/////////////// Keypad Information
// Keypad Information:
const byte ROWS = 4; // Define the number of rows in the keypad - 4
const byte COLS = 3; // Define the number of columns in the keypad - 3
// The following defines the array of keys on the key the matrix must be of type char
char keys[ROWS][COLS] = {
{‘1’, ‘2’, ‘3’},
{‘4’, ‘5’, ‘6’},
{‘7’, ‘8’, ‘9’},
{’’,‘0’,’#’}
};
/
keypad wire configuration (from left to right; where C and R represents
columns and rows, respectively):
Wire 1: C2
Wire 2: R1
Wire 3: C1
Wire 4: R4
Wire 5: C3
Wire 6: R3
Wire 7: R2
*/
// For 4 rows 3 columns keypad there are 7 wires one for each row (R1 to R4) and
// one for each column (C1 to C3). These wires are connected to
// Pins: 34 36 38 40 42 44 46
// The following shows the definitions

byte rowPins[ROWS] = {36, 46, 44, 40}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {38, 34, 42}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

char mm = 00; //stores the value for the month
char dd = 00; //stores the value for the day
char yy = 00; //stores the value for the year
int p = 7; //stores the value for the iteration
int val = 1; //stores the value for the current value
int pos = 4; //stores the value for the cursor position

// Using the keypad library to initialize the keypad
Keypad Numb_pad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
//analogReference(DEFAULT); // Set the analog input range as default

void setup() {
//Set Up Initial Parameters
lcd.begin(16,2); // Specifies the # of rows and columns
delay(500); // wait for 0.5 seconds
lcd.setCursor(2,0);
lcd.print(“name”); // Print a message on the LCD (default start
//printing at line 0 column 0
lcd.setCursor(5,1); // Move the cursor to column 1 line 1
lcd.print(“name”); // Print, in this position, a message
delay(500); // Wait for 3 seconds
lcd.clear(); // Clear the LCD

lcd.setCursor(1,0);
lcd.print(“name”); // Print a message on the LCD (default start
//printing at line 0 column 0
lcd.setCursor(5,1); // Move the cursor to column 1 line 1
lcd.print(“name”); // Print, in this position, a message
delay(500); // Wait for 3 seconds
lcd.clear(); // Clear the LCD

lcd.setCursor(3,0);
lcd.print(“Enter Date”);
lcd.setCursor(3,1);
lcd.print(" / / ");
lcd.setCursor(4,1);
lcd.blink();

//Start communication
Serial.begin(9600); //Set the baud rate to 9600 baud

}
void loop() {

char key = keypad.getKey(); //Store the pressed key value in “key”

if (key) //button Pressed
{
if(key == ‘#’) //Enter Button Pressed
{
pos++; //Increase position counter
if (pos == 6 || pos == 9) //location of slashes
{
pos++; //Increment additional to pass slashes
}
if (pos > 11) //Last digit entered
{
pos = 4; //Set position to beginning position
}
lcd.setCursor(pos,1); //Set cursor Position
}
else //Enter not pressed yet
{
lcd.setCursor(pos,1); //Set cursor Position
lcd.write(key); //Write Value to LCD
lcd.setCursor(pos,1); //Set cursor Position
}

}

//-------------------------------------------------------------------------------------------
}

but when i finish entering the date and press the # it goes back to the initial curser position

Well, you wrote the code that way:

          if (pos > 11)                //Last digit entered
            {
              pos = 4;                 //Set position to beginning position
            }

If you want the code to do something different if pos is greater than 11, don't write the code that way.

2: the second question is to enter the type of object being tested. i want to set it up as to have only the 1 and 2 buttons being used. pressing the '1' buttons means testing a 36" pole and the '2' button being the 42" pole.

You need to ignore other values, then. That could be hard, though, as the Arduino has no idea that there are multiple "questions" that need answers. You will need to keep track of the number of times the # key is pressed, to know what "question" you are on. Having the first "question" require three "answers" is going to make that interesting.