Problem with my rev counter slot car's

Hello everyone! This is my first post in this forum! XD
I’m an italian guy that want to learn Arduino’s code (sorry for my english, i’m helping with a translator).
My problem is when the sensor observes the passage of the car, it doesen’t increase by 1 , instead by more values.
How can i correct this error?
If there’s some language’s error, tell me what you didn’t understand.
I will add my code, programmed with Arduino’s software.
Have a good day!


LAST EDIT :
sensors’ name are “Sharp GP2Y0D810Z0F”
http://www.robot-italy.com/it/1134-sensore-ir-digitale-10cm-pololu-con-sharp-gp2y0d810z0f.html

#include<LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);
int val1 = 0;
int val2 = 0;
int contagiri1 = 0;
int contagiri2 = 0;

void setup()
{
lcd.begin(16,2);
Serial.begin(9600);
}

void loop()
{
lcd.setCursor(0,0);
lcd.print(“Pista 1”);
lcd.setCursor(9,0);
lcd.print(contagiri1);
lcd.setCursor(0,16);
lcd.print(“Pista 2”);
lcd.setCursor(9,16);
lcd.print(contagiri2);
val1 = digitalRead(10);
val2 = digitalRead(9 );
if (val1==0) //increased value “rev counter 1” (“contagiri” is the meaning of “rev counter”
{
contagiri1=contagiri1+1;
}
if (val2==0)
{
contagiri2=contagiri2+1;
}
}

You need to detect a transition. Imagine you wanted to know how many times the light in your room was turned on. You don't add one every time the light is on, you add one every time the light is on when it was previously off.