Line following with magnetic sensor

Guys I have a problem to this code below..
It wont run the motor or proceed to state1 statement.

The sequence should:

If sw is activated and magnetic sensor is activate
the two motors should run then continue to next statement...

I am newbie in Arduino..
Im building this for my project
in school.

This a line following robot with Left IR and Right IR,
magnetic sensor to stop and sw to Run the motor

Here is my code;

/*------ Arduino Line Follower Code----- */
/*-------definning Inputs------*/
#define SW 9      // limit switch
#define MS 8      // magnetic sensor
#define LS 2      // left sensor
#define RS 3      // right sensor

/*-------definning Outputs------*/
#define LM1 4       // left motor (forward)
#define LM2 5       // left motor (reverse) no use
#define RM1 6       // right motor (forward)
#define RM2 7       // right motor (reverse) no use

int swState = 0;
int msState = 0;
int lsState = 0;
int rsState = 0;

void setup() {
  pinMode(SW,INPUT);
  pinMode(MS,INPUT);
  pinMode(LS, INPUT);
  pinMode(RS, INPUT);
  pinMode(LM1, OUTPUT);
  pinMode(LM2, OUTPUT);
  pinMode(RM1, OUTPUT);
  pinMode(RM2, OUTPUT);
}

void loop () {
  swState = digitalRead(SW);
  msState = digitalRead(MS);
  lsState = digitalRead(LS);
  rsState = digitalRead(RS);
  
state1:
    if (swState == LOW || msState == HIGH){
        digitalWrite(LM1,LOW);
        digitalWrite(LM2,LOW);
        digitalWrite(RM1,LOW);
        digitalWrite(RM2,LOW);
        goto state2;
    }
    else {
      goto state1;
    }
state2:
  if (swState == HIGH && msState == HIGH){ 
    digitalWrite(LM1,HIGH);
    digitalWrite(LM2, LOW);
    digitalWrite(RM1,HIGH);
    digitalWrite(RM2,LOW);
    delay(3000);
    goto turnRight;
  }
  else{
    goto state2;
   }
turnRight:
  if(lsState == HIGH && rsState == LOW && msState == LOW) {
    digitalWrite(LM1,LOW);
    digitalWrite(LM2,LOW);
    digitalWrite(RM1,HIGH);
    digitalWrite(RM2,LOW);
    goto turnLeft;
  }
  else if (lsState == LOW && rsState == HIGH && msState == LOW) {
   goto turnLeft;
  }
  else if (msState == HIGH) {
   goto state3;
  }
  else {
    goto turnRight;
  }
turnLeft:
  if(rsState == HIGH && lsState == LOW && msState == LOW) {
    digitalWrite(LM1,HIGH);
    digitalWrite(LM2,LOW);
    digitalWrite(RM1,LOW);
    digitalWrite(RM2,LOW);
    goto turnRight;
  }
  else if (rsState == LOW && lsState == HIGH && msState == LOW) {
    goto turnRight;
  }
  else if (msState == HIGH) {
    goto state3;
  }
  else{
    goto turnLeft;
   }
state3:
  if(msState == HIGH) {
    digitalWrite(LM1,LOW);
    digitalWrite(LM2,LOW);
    digitalWrite(RM1,LOW);
    digitalWrite(RM2,LOW);
    goto state4;
  }
  else{
    goto state3;
   }

/////// RETURN TO CONVEYOR //////////////
state4:
   if(swState == LOW && msState == HIGH) {
      delay(4000);
      digitalWrite(LM1,HIGH);
      digitalWrite(LM2,LOW);
      digitalWrite(RM1,HIGH);
      digitalWrite(RM2,LOW);
      delay(3000);
      goto turnRight2;
    }
 else{
  goto state4;
 }
turnRight2:
  if(lsState == HIGH && rsState == LOW && msState == LOW) {
    digitalWrite(LM1,LOW);
    digitalWrite(LM2,LOW);
    digitalWrite(RM1,HIGH);
    digitalWrite(RM1,LOW);
    goto turnLeft2;
  }
  else if(lsState == LOW && rsState == HIGH && msState == LOW) {
    goto turnLeft2;
  }
  else if (msState == HIGH && swState == LOW) {
    goto state6;
  }
  else {
    goto turnRight2;
   }
turnLeft2:
  if (rsState == HIGH && lsState == LOW && msState == LOW) {
    digitalWrite(LM1,HIGH);
    digitalWrite(LM2,LOW);
    digitalWrite(RM1,LOW);
    digitalWrite(RM2,LOW);
    goto turnRight2;
  }
  else if (rsState == LOW && lsState == HIGH && msState == LOW) {
    goto turnRight2;
  }
  else if (msState == HIGH && swState == LOW) {
    goto state6;
  }
  else{
    goto turnLeft2;
  }
state6:
  if(msState == HIGH) {
    digitalWrite(LM1,LOW);
    digitalWrite(LM2,LOW);
    digitalWrite(RM1,LOW);
    digitalWrite(RM2,LOW);
    goto state2;
  }
  else{ 
    goto state6;
  }  
 
}

please edit your post to add [code][/code] around your code.

#define SW 9      // limit switch

#define MS 8      // magnetic sensor
#define LS 2      // left sensor
#define RS 3      // right sensor

Long variable names are not stored on the Arduino. There's no penalty for longer names. You should take these comments and use them as the variable names instead of the 2-letter names. (Well, these are constants, but it's the same thing.)

Where did you learn goto? It is almost NEVER required in any C or C++ program. You should be able to write programs for your whole life and only use goto once or twice.

I'm sorry..
I am very new to this programming world..
Thank you for the response.

I already change like this...

Is this correct ?

const int limitsw = 9;      // limit switch
const int magnetsens = 8;      // magnetic sensor
const int leftsens = 2;      // left sensor
const int rightsens = 3;      // right sensor

/*-------definning Outputs------*/
const int leftmotor1 = 4;       // left motor
const int leftmotor2 = 5;       // left motor
const int rightmotor1 = 6;       // right motor
const int rightmotor2 = 7;       // right motor

Well, its not wrong.

You may also be helped by: State Machine

Is this correct ?

That part is. The use of goto in the complete program is WRONG!