Problem with buttons on at same time

I'm building a small car as my first project and its pretty simple. I have a gear box with two DC motors and I have each of those motors controlled by two push buttons. It isn't wireless or anything, just a simple little car. The way it is right now, I can control each motor individually. But when I tried to make it so that when I press both buttons both motors spin, only one of the motors will spin.

Here is my code maybe you can tell me what I am doing wrong. Be gentle this is the first script I've written myself. Sorry for lack of comments.

void setup() {
  pinMode(2, INPUT);
  pinMode(3, INPUT);
  pinMode(12, OUTPUT);
  pinMode(11, OUTPUT);
}

void loop() {
  int sensorValueone = digitalRead(2);
  int sensorValuetwo = digitalRead(3);
  
 if (sensorValueone == 1){
   digitalWrite(12, HIGH);
   digitalWrite(11, LOW);
 }
 else if (sensorValuetwo == 1) {
   digitalWrite(11, HIGH);
   digitalWrite(12, LOW);
 }
 else if ((sensorValueone && sensorValuetwo) == 1){   // this is the where I believe the problem to be
   digitalWrite(11, HIGH);
   digitalWrite(12, HIGH);
 }
 else{
   digitalWrite(12, LOW);
   digitalWrite(11, LOW);
 }
   
}
if (a==1 && b==1)
 if (sensorValueone == 1){

You should be using the HIGH and LOW constants, here, too.

 else if ((sensorValueone && sensorValuetwo) == 1){   // this is the where I believe the problem to be

Suppose you were trying to compare two numbers to 7, instead of 1. How would you do that? This is NOT how.

else if(sensorValueone == HIGH && sensorValuetwo == HIGH)
{

I'm still having the same problem. I don't think anything is wrong with my wiring, but I will take a closer look at it. Any ideas?

You have, in essence:

if (a==1)
{
  do stuff
}
else if (b==1)
{
  do stuff
}
else if ((a==1) && (b==1))
{
  do stuff
}

As you have a chain of if/else statements, logically you will never reach the last if.

I'm still having the same problem.

So post your latest code with the corrections we told you to make and we will see if you have made them correctly and if there are any more mistakes.

This is what I have now.

void setup() {
  pinMode(2, INPUT);
  pinMode(3, INPUT);
  pinMode(12, OUTPUT);
  pinMode(11, OUTPUT);
}

void loop() {
  int sensorValueone = digitalRead(2);
  int sensorValuetwo = digitalRead(3);
  
 if(sensorValueone == HIGH && sensorValuetwo == HIGH){ 
   digitalWrite(11, HIGH);
   digitalWrite(12, HIGH);
 }
  
 else if (sensorValueone == HIGH){
   digitalWrite(12, HIGH);
   digitalWrite(11, LOW);
 }
 else if (sensorValuetwo == HIGH) {
   digitalWrite(11, HIGH);
   digitalWrite(12, LOW);
 }

 else{
   digitalWrite(12, LOW);
   digitalWrite(11, LOW);
 }
   
}

This is what I have now.

And? It works? There is still a problem?

Yes i still have the same original problem.

Blankety blanking slow forum is loosing posts and pissing me off.

I'll try again.

void setup() {
pinMode(2, INPUT);
pinMode(3, INPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
Serial.begin(57600);
}

void loop() {
int sensorValueone = digitalRead(2);
int sensorValuetwo = digitalRead(3);
Serial.print("Switch values: ");
Serial.print(sensorValueone);
Serial.print(" and ");
Serial.println(sensorValuetwo);

if(sensorValueone == HIGH && sensorValuetwo == HIGH){
digitalWrite(11, HIGH);
digitalWrite(12, HIGH);
}

else if (sensorValueone == HIGH){
digitalWrite(12, HIGH);
digitalWrite(11, LOW);
}
else if (sensorValuetwo == HIGH) {
digitalWrite(11, HIGH);
digitalWrite(12, LOW);
}

else{
digitalWrite(12, LOW);
digitalWrite(11, LOW);
}
delay(500);
}

Add the highlighted code to yours. Upload, and open the Serial Monitor. Set the speed to 57600, in the lower, right corner.

Show us the output. We don't know if you are chasing a software problem (unlikely) or a hardware problem (would be my guess, now).

How are the switches wired?

Now it is working. I'm not exactly sure why. I sort of rewired it, but it is the same as it was before. I might have had a short or something.

But anyways, thanks for your help guys. This community is so active and helpful.

Actually I just realized I used different transistors. So maybe that was the problem.