/*
I need help with a CASE or IF STATEMENT, I THINK!
I take in a CAR VIN NUMBER and then use a STRING function to take it apart.
I need to Convert THE STRING value to ANOTHER VALUE depending on the original value of the STRING.
EXAMPLE: $country=substr($vin_num,0,1);
returned value = 2
THEN: $country now needs a value of CANADA see Decoding VIN Numbers at the bottom of the page.
ALL ideas, suggestions and help is greatly appreciated.
Thank you
JZđ
*/
// vin_decode.php
<?
// $vin = addslashes($_POST['vin']) comes from form
$vin = '2cdEG25KbN4504359'; // this set up for test
$vin_num = strtoupper($vin);
$country=substr($vin_num,0,1);
$car_maker=substr($vin_num,1,1);
$car_type=substr($vin_num,2,1);
$car_features=substr($vin_num,3,4);
$vin_correct=substr($vin_num,8,1);
$car_year=substr($vin_num,9,1);
$car_plant=substr($vin_num,10,1);
$car_sequence=substr($vin_num,11,6);
echo 'Origin: ';
echo $country;
echo '<br>';
echo 'Manufacturer: ';
echo $car_maker;
echo '<br>';
echo 'Division: ';
echo $car_type;
echo '<br>';
echo 'Features: ';
echo $car_features;
echo '<br>';
echo 'Correct Vin: ';
echo $vin_correct;
echo '<br>';
echo 'Car Year: ';
echo $car_year;
echo '<br>';
echo 'Mfg. Plant ';
echo $car_plant;
echo '<br>';
echo 'Serial Number: ';
echo $car_sequence;
?>
/*
Decoding VIN Numbers
NOTE: the letter "O" as in orange, and the letter "Q" as in queen are NOT found in any
VIN Numbers.
1st character- Identifies Country of Manufacture
United States (1 or 4), Canada (2), Mexico (3), Japan (J), Korea (K), Great Britian (S), Germany (W), Italy (Z)
2nd character- Identifies the manufacturer.
For example; Audi (A), BMW (đ, Buick (4), Cadillac (6), Chevrolet (1), Chrysler (C), Dodge (đ,Ford (F), GM Canada (7), General Motors (G), Honda (H), Jaquar (A), Lincoln (L), Mercedes Benz (D), Mercury (M), Nissan (N), Oldsmobile (3), Pontiac (2 or 5), Plymouth (P), Saturn (8), Toyota (T), VW (V), Volvo (V).
3rd character- Identifies vehicle type or manufacturing division.
4th to 8th characters- Identifies vehicle features such as body style, engine type, model, series, etc.
9th character- Identifies VIN accuracy (check digit).
10th character- Identifies the model year. For example: 1988(J), 1989(K), 1990(L), 1991(M), 1992(N), 1993(P), 1994(R), 1995(S), 1996(T),1997(V), 1998(W), 1999(X), 2000(Y)------2001(1), 2002(2), 2003(3)
11th character- Identifies the assembly plant for the vehicle.
12th to 17th characters- Identifies the sequence of the vehicle for production as it rolled off the manufacturer's assembly line. The VIN is usually found on the dashboard on the driver's side. It is also found on the driver's side door post near the striker plate. The VIN may also be found on major components of some high-theft cars.
*/đ