When I echo out that statement in the else statement, nothing shows up. Likewise, when I take away that second set of parenthesis, nothing shows up. In fact, skips over that set of if-else statements altogether and echoes the next set. I'm stumped! Here's my code. I'm going to use switch statements in the future. I'm just trying to get this figured out first.
<?php
$decode=$_POST['VIN'];
$Make=substr($decode,0,1);
if ($Make == "4"){
echo "Buick<br />";
} else {
echo "This is not a valid Make";
}
$Series=strtoupper(substr($decode,1,1));
if ($Series == "D" && $ModelYear == "2"){
echo "Skylark";
} elseif ($Series == "F"){
echo "Sport Wagon";
} elseif ($Series == "G"){
echo "GS";
} elseif ($Series == "H"){
echo "Skylark Custom";
} elseif ($Series == "L"){
echo "Lesabre";
} elseif ($Series == "N"){
echo "Lesabre Custom";
} elseif ($Series == "P"){
echo "Centurion";
} elseif ($Series == "R"){
echo "Estate Wagon";
} elseif ($Series == "U"){
echo "Electra 225";
} elseif ($Series == "V"){
echo "Electra 225 Custom";
} elseif ($Series == "Y"){
echo "Riviera";
} else {
echo "This is not a valid Body Style";
}
$BodyStyle=substr($decode,2,2);
if ($BodyStyle == "27"){
echo "2-door Coupe";
} elseif ($BodyStyle == "35"){
echo "2-seat Station Wagon";
} elseif ($BodyStyle == "36"){
echo "2-seat Sport Wagon";
} elseif ($BodyStyle == "37"){
echo "2-door Hardtop";
} elseif ($BodyStyle == "39"){
echo "4-door Hardtop";
} elseif ($BodyStyle == "45"){
echo "3-seat Station Wagon";
} elseif ($BodyStyle == "47"){
echo "2-door Hardtop";
} elseif ($BodyStyle == "57"){
echo "2-door Hardtop";
} elseif ($BodyStyle == "67"){
echo "2-door Convertible";
} elseif ($BodyStyle == "69"){
echo "4-door Sedan";
} elseif ($BodyStyle == "87"){
echo "2-door Hardtop";
} else {
echo "This is not a valid Body Style";
}
$Engine=strtoupper(substr($decode,4,1));
if ($Engine == "G"){
echo "350 1-2bbl. Dual Exhaust";
} elseif ($Engine == "H"){
echo "350 1-2bbl.";
} elseif ($Engine == "J"){
echo "350 1-4bbl.";
} elseif ($Engine == "K"){
echo "350 1-4bbl. Dual Exhaust";
} elseif ($Engine == "T"){
echo "455 1-4bbl.";
} elseif ($Engine == "U"){
echo "455 1-4bbl. Dual Exhaust";
} elseif ($Engine == "V"){
echo "455 1-4bbl. Stage 1";
} elseif ($Engine == "W"){
echo "455 1-4bbl. Stage 1";
} else {
echo "This is not a valid Engine";
}
$ModelYear=substr($decode,5,1);
if ($ModelYear == "2"){
echo "197$ModelYear";
}else{
echo "This is not a valid Model Year";
}
$AssemblyPlant=strtoupper(substr($decode,6,1));
if ($AssemblyPlant == "C"){
echo "Southgate, California";
} elseif ($AssemblyPlant == "G"){
echo "Framingham, Massachusetts";
} elseif ($AssemblyPlant == "H"){
echo "Flint, Michigan";
} elseif ($AssemblyPlant == "X"){
echo "Fairfax, Kansas";
} elseif ($AssemblyPlant == "Y"){
echo "Wilmington, Delaware";
} elseif ($AssemblyPlant == "Z"){
echo "Fremont, California";
}else{
echo "This is not a valid Assembly Plant";
}
$ProductionNumber=substr($decode,7,6);
if (is_numeric($ProductionNumber)){
echo $ProductionNumber - 100001;
}else {
echo "This is not a valid Production Number";
}
?>