Multiple Buttons multiple leds

When I put the second IF statement in, the red light is always on.
I'm trying to make the light green if the A button is pressed and red if the D button is pressed. Here is my code. What am I doing wrong?

const int buttona= 6;
const int buttond = 4;

const int redPin= 8;
const int greenPin = 7;

int buttonStatea = 0;
int buttonStated = 0;

void setup() {
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(buttona, INPUT);
pinMode(buttond, INPUT);


void loop() {
buttonStatea = digitalRead (buttona);
buttonStated = digitalRead (buttond);

if(buttonStatea == HIGH)
digitalWrite(greenPin, HIGH);
digitalWrite (greenPin, LOW);
if (buttonStated == HIGH)
digitalWrite(redPin, HIGH);
digitalWrite(redPin, LOW);


question1.ino (1.21 KB)

How are your buttons wired up? Do you have external pull-down resistors on them? Or are they floating when not pressed?