Beginner problem with DC motor
To analyze your problem:


Switch two wires between two motors (and repeat this to get all combinations), to find out if the code/wiring until the motors is wrong, or there is a problem with the motors.
Print out the values of pins 9, 10, 11 and 12 and the value of t/input to see if the pins are controlled as you expect.
Remove all but one motors, for all motors one at a time, to see if there is no influence between them.


Below is not an answer to your question, but I can only align the code as answer.

It is better coding style to use the following form:

void loop() {
  if(Serial.available()){
    t = Serial.read();
    Serial.println(t);
  }

  if ((t &gt;= '1') &amp;&amp; (t &lt;= '5'))      
  {
    int input = (int) t - (int)'0';

    digitalWrite( 9, (input == 1) || (input == 4) ? HIGH : LOW);
    digitalWrite(10, (input == 2)                 ? HIGH : LOW);
    digitalWrite(11, (input == 1) || (input == 3) ? HIGH : LOW);
    digitalWrite(12, (input == 2)                 ? HIGH : LOW);
  }

  delay(100);
}


Note: ? : is a ternary operator which means : a ? b : c => if a then b else c.

Instead of using 9, 10, 11, 12 define pin numbers (e.g. PIN_MOTOR_X), and for 1, 2, 3, 4, 5 input numbers define LEFT, RIGHT, UP/FORWARD, DOWN/BACKWARD, STOP.