Arduino RF car cotinue to move, code to stop it?

I am using Arduino Nano with 433MHZ TX/RX
(http://www.banggood.com/5Pcs-433Mhz-RF-Transmitter-With-Receiver-Kit-For-Arduino-MCU-Wireless-p-951033.html)
to control the car. I am new to programming.
I have given reference to virtualWire.h.
In TX I am using following code to move car forward:

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);
  }

In receiver I am using code:

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;
        	// 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");
      }

void forward()
{

  digitalWrite (pinA1, LOW);
  digitalWrite (pinA2, HIGH);
digitalWrite (pinC1, LOW);
  digitalWrite (pinC2, HIGH);

}

This code works perfect but the car continue to move even after I release the button. When I press the reverse button the car continue its motion in reverse side. I want to change code in TX or RX to stop forward motion when i depress the forward button.
I found a way out to capture depress button in TX code by sending another number say 5 to receiver and use this to stop the car. But I think there is some easy way to do this where you can help me.

In this code :

        if(buf[i] == '1')//if button 1 is pressed.... i.e.forward buton
      {
        forward();//go forward
        Serial.println(" = forward");
      }

Replace ‘if’ with ‘while’.
ie.

        while(buf[i] == '1')//if button 1 is pressed.... i.e.forward buton
      {
        forward();//go forward
        Serial.println(" = forward");
      }

This is because once 1 is sent , the receiver retains the value , you need to change the program so that when the button isn’t pressed , it sends 0 . Thus the code with while will work.

Thanks for the reply,
I have tested by sending '0' to receiver when no button is pressed. This works but it keeps busy tx, rx all the time even when the car is standing. In addition one strange thing also starts that when i want to reverse the car, there is some delay now i.e. the car will continue forward motion for a fraction of second before it decides to go reverse. The spring button on tx sending '1' in forward has to pass through center (sending 0) and then to other side to send '2' for reverse. May be passing from 1-----0-----2 is too fast to handle by tx and rx, i cant say anything.
This is the reason i want rx to understand that when no button is pressed, keep the car in stop condition. This is the same situation when i first turn on tx and rx, car is motionless as tx is not sending anything. How i can do this by code?

Well , then you can put :

but*=0; after the if condition.*
Anyways the loop is continuously repeating.
What else you can try is that the sender sends a no. , (0 over here) at the starting of the void loop() ,
a condition checks if the value is zero , if the value is zero it doesn't execute the loop.
ie.

void loop(){
_ if(but*==0)_
_
return;_
_
}*_

Here is complete tx code:

Can you pl. sort out where i need to put 0 value

int forward = 8;
int backward = 9;
int rightTurn = 10;
int leftTurn = 11;
int remotePins[]= {8,9,10,11};//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<5 ; 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(6, INPUT);

        digitalWrite(8, HIGH);
        digitalWrite(9, HIGH);
        digitalWrite(10, HIGH);
        digitalWrite(11, HIGH);
        digitalWrite(6, 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);
  
      } 

}//close loop

Here is complete code in receiver:

/**
 
//Pinouts

#include <VirtualWire.h>
//Motor A -Front drive

int pinA1 = 11;    //11
int pinA2 = 10;    //10

///Motor B-Rear drive

int pinB1 = 5;    //5
int pinB2 = 4;  //4

///Motor C (steering)
int pinC1 = 8;    //8
int pinC2 = 7;  //7


void setup()
{
 Serial.begin(9600);
   // Initialise the IO and ISR
    vw_setup(2000);	 // Bits per sec
    vw_set_rx_pin(6);    //Rx Data pin to Digital  Pin 6
    vw_rx_start();       // Start the receiver PLL running
 /* Initialize Motor A Pin Modes */

  pinMode (pinA1, OUTPUT);
  pinMode (pinA2, OUTPUT);  
  
 /* Initialize Motor B Pin Modes */  
 
  pinMode (pinB1, OUTPUT);
  pinMode (pinB2, OUTPUT); 

 /* Initialize Motor C Pin Modes */  
  
  pinMode (pinC1, OUTPUT);
  pinMode (pinC2, OUTPUT); 
 
}
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;

        	// 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
      {
        goBack();//go backward
        Serial.println(" = backward");
      }
        if(buf[i] == '3')//if button 3 is pressed.... i.e.left buton
      {
        turnLeft();//go left
        Serial.println(" = left");
      }
        if(buf[i] == '4')//if button 4 is pressed.... i.e.right buton
      {
        turnRight();//go right
        Serial.println(" = right");
      }
       
    }                    
      }
                   
    }        
      

 
//function to go forward
void forward()
{
 
  digitalWrite (pinA1, LOW);
  digitalWrite (pinA2, HIGH);
digitalWrite (pinC1, LOW);
  digitalWrite (pinC2, HIGH);

}


//function to stop Motor AC movement
void stopMotorAC()
{
digitalWrite (pinA1,LOW);
  digitalWrite (pinA2,LOW);  
digitalWrite (pinC1, LOW);
  digitalWrite (pinC2, LOW);
}

//function to go back
void goBack()
{
  
  digitalWrite (pinA1,HIGH);
  digitalWrite (pinA2,LOW);
  digitalWrite (pinC1,HIGH);
  digitalWrite (pinC2,LOW);
}
//function to stop Motor B movement
void stopMotorB()
{ 
 digitalWrite (pinB1, LOW);
  digitalWrite (pinB2, LOW); 
}
//function to turn the RC car right
void turnRight()
{
 
  digitalWrite (pinB1, LOW);
  digitalWrite (pinB2, HIGH);  
}
//function to turn the RC car left
void turnLeft()
{
 
  digitalWrite (pinB1,HIGH);
  digitalWrite (pinB2,LOW);  
}

In tx code , add(in the void loop() part.) :

if(digitalRead(forward) == HIGH&&digitalRead(backward) == HIGH)//no button is pressed.
             char *msgx = "0";//send 0 to the receiver
    digitalWrite(13, true); // Flash a light to show transmitting
    vw_send((uint8_t *)msgx, strlen(msgx));//send the byte to the receiver
    vw_wait_tx(); // Wait until the whole message is gone
    digitalWrite(13, false);

AND in the receiver put this (in the void loop() part.)

if(buf[i] == '0')//if no button is pressed....
      {
        Serial.println(" = at halt");
        }