I'm having a problem with my vin decoder after a site redesign, it seems to pull all the columns in the model table instead of decoding the vin number.
heres the url http://hp-car.com/vin-decoder
<br />
Heres a vin number from a 1969 Camaro 124679N612546, this should tell you whats happening with the decoder.
<br />
Heres the code the index page first.
<form action="search/search_vin.php" method="post" enctype="multipart/form-data" name="vin_decoder" id="vin_decoder">
<table width="100%" >
<tr>
<th align="right" scope="row"><font color="#80FFFF"><strong>Make : </strong>
<?php
// initialize or capture variable
$Make = !isset($_Post['Make'])? NULL : $_Post['Make'];
?>
</font></th>
<td><font color="#80FFFF">
<select name="Make" value="">
<option value=""></option>
<option value="Buick">Buick</option>
<option value="Chevrolet">Chevrolet</option>
<option value="Chrysler">Chrysler</option>
<option value="Dodge">Dodge</option>
<option value="Oldsmobile">Oldsmobile</option>
<option value="Plymouth">Plymouth</option>
<option value="Pontiac">Pontiac</option>
<option value="Ford">Ford</option>
</select>
</font></td>
</tr>
<tr>
<th align="right" scope="row"><font color="#80FFFF"><strong>Year :</strong>
<?php
// initialize or capture variable
$year = !isset($_Post['year'])? NULL : $_Post['year'];
?>
</font></th>
<td><font color="#80FFFF">
<select name="Year" id="Year" value="">
<option value=""></option>
<option value="1">1965</option>
<option value="2">1966</option>
<option value="3">1967</option>
<option value="4">1968</option>
<option value="5">1969</option>
<option value="6">1970</option>
<option value="7">1971</option>
<option value="8">1972</option>
<option value="9">1973</option>
</select>
</font></td>
</tr>
<tr>
<th align="right" scope="row">Model :<font color="#80FFFF">
<?php
// initialize or capture variable
$Model = !isset($_Post['Model'])? NULL : $_Post['Model'];
?>
</font> <font color="#80FFFF"> </font></th>
<td><font color="#80FFFF">
<input name="Model" type="text" id="Model" size="30" maxlength="100">
</font></td>
</tr>
<tr>
<th align="right" scope="row"><strong><font color="#80FFFF">Vin # :
<?php
// initialize or capture variable
$vin = !isset($_Post['vin'])? NULL : $_Post['vin'];
?>
</font></strong></th>
<td><input name="vin" type="text" id="vin" size="30" maxlength="100"></td>
</tr>
<tr>
<th scope="row"> </th>
<td><input name="Decode It" type="submit" id="Decode It" value="Decode It">
<input name="Clear" type="reset" id="Clear" value="Clear"></td>
</tr>
</table>
</script></td>
</tr>
<tr>
<td></td>
</tr>
</table>
</body>
</html>
<br />
And heres the page that I think has the problems.
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
<title>Vin Search</title>
</head>
<body>
<center><h1>Thank you for using our Vin Decoder</h1></center>
<?php
$username = "000000";
$password = "000000";
$hostname = "localhost";
$dbh = mysql_connect($hostname, $username, $password)
or die("(".mysql_errno().") Error:".mysql_error());
$selected = mysql_select_db("hotrod",$dbh)
or die("(".mysql_errno().") Error:".mysql_error());
include("template.php");
require("kword.php");
require("Classes.php");
require("config.php");
$query_where = "";
if (isset($_POST['make'])) {
if ($query_where == "") {
$query_where .= " where ";
} else {
$query_where .= " and ";
}
$query_where .= "make='" . $_POST['make'] . "'";
}
if (isset($_POST['model'])) {
if ($query_where == "") {
$query_where .= " where ";
} else {
$query_where .= " and ";
}
$query_where .= "model='" . $_POST['model'] . "'";
}
if (isset($_POST['year'])) {
if ($query_where == "") {
$query_where .= " where ";
} else {
$query_where .= " and ";
}
$query_where .= "year='" . $_POST['year'] . "'";
}
if (isset($_POST['Price_Class'])) {
if ($query_where == "") {
$query_where .= " where ";
} else {
$query_where .= " and ";
}
$query_where .= "Price_Class='" . $_POST['Price_Class'] . "'";
}
if (isset($_POST['Engine'])) {
if ($query_where == "") {
$query_where .= " where ";
} else {
$query_where .= " and ";
}
$query_where .= "Engine='" . $_POST['Engine'] . "'";
}
if (isset($_POST['Styles'])) {
if ($query_where == "") {
$query_where .= " where ";
} else {
$query_where .= " and ";
}
$query_where .= "Styles='" . $_POST['Styles'] . "'";
}
if (isset($_POST['assembly'])) {
if ($query_where == "") {
$query_where .= " where ";
} else {
$query_where .= " and ";
}
$query_where .= "assembly='" . $_POST['assmebly'] . "'";
}
$query = "select * from manufacture " . $query_where;
$result = mysql_query($query)
or die("(".mysql_errno().") Error:".mysql_error());
$fields = mysql_num_fields($result);
echo "<table>\n<tr>";
for ($i=0; $i < $fields; $i++) //Table Header
echo "</tr>\n";
$query = "select * from assembly " . $query_where;
$result = mysql_query($query)
or die("(".mysql_errno().") Error:".mysql_error());
$fields = mysql_num_fields($result);
echo "<table>\n<tr>";
for ($i=0; $i < $fields; $i++) //Table Header
echo "</tr>\n";
$query = "select * from engine " . $query_where;
$result = mysql_query($query)
or die("(".mysql_errno().") Error:".mysql_error());
$fields = mysql_num_fields($result);
echo "<table>\n<tr>";
for ($i=0; $i < $fields; $i++) //Table Header
echo "</tr>\n";
$query = "select * from model " . $query_where;
$result = mysql_query($query)
or die("(".mysql_errno().") Error:".mysql_error());
$fields = mysql_num_fields($result);
echo "<table>\n<tr>";
for ($i=0; $i < $fields; $i++) //Table Header
echo "</tr>\n";
while ($row = mysql_fetch_row($result)) { //Table body
echo "<tr>";
for ($f=0; $f < $fields; $f++) {
echo "<td>$row[$f]</td>"; }
echo "</tr>\n";}
echo "</table>";
mysql_free_result($result);
?>
</body>
</html>