Need help with code for button state over RF for my RC car project

Hey guys,
I am working on my first radio controlled car. I am using code I found on istructables.com to control it. It uses 5 buttons (2 for left forward/reverse, 2 for right forward/reverse, and 1 to stop motors). Everything works fine but when I press the button to make left or right go forward(or reverse), the motors keep going until I press the stop button. What I want is for the motors to move ONLY when I have a button pressed. They should stop when I release the button. Below is the code. I would also like to simplify the code if possible. Any help would be much appreciated. Also I could use some help on replacing the buttons with joystick modules. Thanks for your time.

TX Code:

// TRANSMITTER CODE

//NOTE :- THIS TRANSMITTER CODE IS USED WHEN YOU WANT TO CONTROL THE ROBOT VIA THE BREADBOARD REMOTE
#include <VirtualWire.h>

//Assigning controller buttons to Digital Pins
int forward = 8;
int backward = 9;
int rightTurn = 10;
int leftTurn = 11;
int stopMotor = 12;
int remotePins[]= {8,9,10,11,12};//array to store pin nos

void setup()
{
    Serial.begin(9600);    // Debugging only
    Serial.println("setup");
    // Initialise the IO and ISR
    vw_setup(2000);  // Bits per sec
    vw_set_tx_pin(3); //Transmitter Data Pin to Digital Pin 3
        
 
    for(int i = 0; i<6 ; i++)
    {
      pinMode(remotePins[i], INPUT);
      digitalWrite(remotePins[i],HIGH);
    }
      /*
      This is what the loop above does :-
        pinMode(8, INPUT);
        pinMode(9, INPUT);
        pinMode(10, INPUT);
        pinMode(11, INPUT);
        pinMode(12, INPUT);

        digitalWrite(8, HIGH);
        digitalWrite(9, HIGH);
        digitalWrite(10, HIGH);
        digitalWrite(11, HIGH);
        digitalWrite(12, HIGH);*/
}//close setup

void loop()
{
  char *msg2;
  
  if(digitalRead(forward) == LOW)//if the forward button is pressed
  {
    char *msg2 = "1";//send 1 to the receiver
    digitalWrite(13, true); // Flash a light to show transmitting
    vw_send((uint8_t *)msg2, strlen(msg2));//send the byte to the receiver
    vw_wait_tx(); // Wait until the whole message is gone
    digitalWrite(13, false);
  }
  
  if(digitalRead(backward) == LOW)//if the back button is pressed
  {
    char *msg2 = "2";///send 2 to the receiver
    digitalWrite(13, true); // Flash a light to show transmitting
    vw_send((uint8_t *)msg2, strlen(msg2));//send the byte to the receiver
    vw_wait_tx(); // Wait until the whole message is gone
    digitalWrite(13, false);
  }
  
  if(digitalRead(leftTurn) == LOW)//if the left button is pressed
  {
    char *msg2 = "3";//send 3 to the receiver
    digitalWrite(13, true); // Flash a light to show transmitting
    vw_send((uint8_t *)msg2, strlen(msg2));//send the byte to the receiver
    vw_wait_tx(); // Wait until the whole message is gone
    digitalWrite(13, false);
  }
  
  if(digitalRead(rightTurn) == LOW)//if the right button is pressed
  {
    char *msg2 = "4";//send 4 to the receiver
    digitalWrite(13, true); // Flash a light to show transmitting
    vw_send((uint8_t *)msg2, strlen(msg2));//send the message to the receiver
    vw_wait_tx(); // Wait until the whole message is gone
    digitalWrite(13, false);
  }
  
  if(digitalRead(stopMotor)==LOW)//if the stop button is pressed
  {
   char *msg2 = "5";//send 5 to the receiver
   digitalWrite(13, true); // Flash a light to show transmitting
   vw_send((uint8_t *)msg2, strlen(msg2));//send the message to the receiver
   vw_wait_tx(); // Wait until the whole message is gone
    digitalWrite(13, false);
  } 
}//close loop
  
 // End Of Code

RX Code:

// RECIEVER CODE

//NOTE :- THIS CODE IS USED WHEN CONTROLLING THE ROBOT VIA THE BREADBORD REMOTE

#include <VirtualWire.h>

//declaring pin nos to FIRST L293D
int en1 = 5;
 int en2 = 6;
 int in1 = 7;
 int in2 = 8;
 int in3 = 9;
 int in4 = 10;
 //declaring pin nos to SECOND L293D
 int en1o2 = 3;
 int en2o2 = 11;
 int in1o2 = 4;
 int in2o2 = 12;
 int in3o2 = 14;
 int in4o2 = 15;
 int motorPin[] = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15};//array for storing pin nos

void setup()
{
    Serial.begin(9600);  // Debugging only
    Serial.println("setup");

    // Initialise the IO and ISR
    vw_setup(2000);  // Bits per sec
    vw_set_rx_pin(2);    //Rx Data pin to Digital  Pin 2
    vw_rx_start();       // Start the receiver PLL running

    for (int i = 0; i < 12; i++) 
   {
          pinMode(motorPin[i], OUTPUT);
   }
/*
This is basically what the above for loop does :-
pinMode(en1, OUTPUT);
pinMode(en2, OUTPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(in3, OUTPUT);
pinMode(in4, OUTPUT);
pinMode(en1o2, OUTPUT);
pinMode(en2o2, OUTPUT);
pinMode(in1o2, OUTPUT);
pinMode(in2o2, OUTPUT);
pinMode(in3o2, OUTPUT);
pinMode(in4o2, OUTPUT);
*/
}//close setup

void loop()
{
    uint8_t buf[VW_MAX_MESSAGE_LEN];
    uint8_t buflen = VW_MAX_MESSAGE_LEN;

    if (vw_get_message(buf, &buflen)) // Non-blocking
    {
  int i;

        digitalWrite(13, true); // Flash a light to show received good message
  // Message with a good checksum received, dump it.
  for (i = 0; i < buflen; i++)
  {
   Serial.print(buf[i]);//print received command
        if(buf[i] == '1')//if button 1 is pressed.... i.e.forward buton
      {
        forward();//go forward
        Serial.println(" = forward");
      }
    if(buf[i] == '2')//if button 2 is pressed.... i.e.back buton
      {
        backward();//go backward
        Serial.println(" = backward");
      }
        if(buf[i] == '3')//if button 3 is pressed.... i.e.left buton
      {
        left();//go left
        Serial.println(" = left");
      }
        if(buf[i] == '4')//if button 4 is pressed.... i.e.right buton
      {
        right();//go right
        Serial.println(" = right");
      }
        if(buf[i] == '5')//if button 5 is pressed.... i.e.stop buton
       {
         stopMotor();//stop/brake
         Serial.println(" = stopped");
       }
      Serial.print(" ");
  }
  Serial.println("");
        digitalWrite(13, false);

   }//close if
}//close loop


////////////////////////////////////////////////////////////////////////////////////////
//set of functions

void forward()
{
  digitalWrite(en1,HIGH);
  digitalWrite(en2,HIGH);
  digitalWrite(en1o2,HIGH);
  digitalWrite(en2o2,HIGH);
  digitalWrite(in1,HIGH);
  digitalWrite(in1o2,HIGH);
  digitalWrite(in2,LOW);
  digitalWrite(in2o2,LOW);
  digitalWrite(in3,LOW);
  digitalWrite(in3o2,LOW);
  digitalWrite(in4,HIGH);
  digitalWrite(in4o2,HIGH);
  }
  
  
void backward()
{
  digitalWrite(en1,HIGH);
  digitalWrite(en2,HIGH);
  digitalWrite(en1o2,HIGH);
  digitalWrite(en2o2,HIGH);
  digitalWrite(in1,LOW);
  digitalWrite(in1o2,LOW);
  digitalWrite(in2,HIGH);
  digitalWrite(in2o2,HIGH);
  digitalWrite(in3,HIGH);
  digitalWrite(in3o2,HIGH);
  digitalWrite(in4,LOW);
  digitalWrite(in4o2,LOW);
  
}

void left()
{
  digitalWrite(en1,HIGH);
  digitalWrite(en2,HIGH);
  digitalWrite(en1o2,HIGH);
  digitalWrite(en2o2,HIGH);
  digitalWrite(in1,LOW);
  digitalWrite(in1o2,LOW);
  digitalWrite(in2,LOW);
  digitalWrite(in2o2,LOW);
  digitalWrite(in3,LOW);
  digitalWrite(in3o2,LOW);
  digitalWrite(in4,HIGH);
  digitalWrite(in4o2,HIGH);
  
}

void right()
{
  digitalWrite(en1,HIGH);
  digitalWrite(en2,HIGH);
  digitalWrite(en1o2,HIGH);
  digitalWrite(en2o2,HIGH);
  digitalWrite(in1,HIGH);
  digitalWrite(in1o2,HIGH);
  digitalWrite(in2,LOW);
  digitalWrite(in2o2,LOW);
  digitalWrite(in3,LOW);
  digitalWrite(in3o2,LOW);
  digitalWrite(in4,LOW);
  digitalWrite(in4o2,LOW);
  
}

void stopMotor()
{
  digitalWrite(en1,HIGH);
  digitalWrite(en2,HIGH);
  digitalWrite(en1o2,HIGH);
  digitalWrite(en2o2,HIGH);
  digitalWrite(in1,LOW);
  digitalWrite(in1o2,LOW);
  digitalWrite(in2,LOW);
  digitalWrite(in2o2,LOW);
  digitalWrite(in3,LOW);
  digitalWrite(in3o2,LOW);
  digitalWrite(in4,LOW);
  digitalWrite(in4o2,LOW);
}
  
 //End Of Code

What I want is for the motors to move ONLY when I have a button pressed. They should stop when I release the button.

You need to look at the state change detection example. Send one value when a switch BECOMES pressed, and another when the switch BECOMES released.

Sweet. Thats what I was looking for. Thanks for the help. One more question. Do I add the state change to the transmitter code or the receiver code? Or do both sides need code to read the state change of the button?

Do I add the state change to the transmitter code or the receiver code?

Where does the state of the switch change?

Yeah, it was late when I asked that. It hit me as I was headed to bed. All is working as i want it to now. Thanks for the help.