How would i go about this? Part finder

Hi,

I’m a complete programming novice. I was hoping someone here could point me in the right direction on how to create a simple drop down list of vehicle manufacturers, which will then show another simple list of vehicle models, and finally on selecting the model, will show a table, text, list or whatever of suitable parts.

Something like this would be ideal:

Unfortunately i don’t have a clue there to start.

Here is a nice tutorial to get you started:

http://www.plus2net.com/php_tutorial/php_drop_down_list.php

If you have more questions, I’m sure members here have the answers.

Database is definately the way to go with this UNLESS you are only going to have a few makes and models and changes wont need to made often, in which case you could hardcode the makes and models and use Javascript to update the boxes.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en"><head><meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title></title>
<script type="text/javascript">
var makes = new Array("BMW", "Ford");
var models = new Array();models["BMW"] = new Array("318", "525", "650", "X5");models["Ford"] = new Array("Bronco", "Explorer", "Focus");
function resetForm(theForm) { /* reset makes */  
 theForm.makes.options[0] = new Option("Please select a make", "");  
 for (var i=0; i<makes.length; i++) {    
  theForm.makes.options[i+1] = new Option(makes[i], makes[i]);  
 }  
 theForm.makes.options[0].selected = true;  /* reset models */  
 theForm.models.options[0] = new Option("Please select a model", "");  
 theForm.models.options[0].selected = true;
}
function updateModels(theForm) {  
 var make = theForm.makes.options[theForm.makes.options.selectedIndex].value;  
 var newModels = models[make];  
 theForm.models.options.length = 0;  
 theForm.models.options[0] = new Option("Please select a model", "");  
 for (var i=0; i<newModels.length; i++) {    
   theForm.models.options[i+1] = new Option(newModels[i], newModels[i]);  
 }  
 theForm.models.options[0].selected = true;
}
</script>
</head>
<body>
<form name="autoSelectForm" action="" method="post">
<select size="1" name="makes" onchange="updateModels(this.form)">
</select><select size="1" name="models"></select>
<input type="submit">
</form>
<script type="text/javascript">  
resetForm(document.autoSelectForm);
</script>
<?php  
$make = $_POST['makes'];  
$model = $_POST['models'];  
if ($make && $model) {    
 echo "<p>".$make." - ".$model."</p>";  
}?>
</body>
</html>