{source}

<?php
require ($_SERVER['DOCUMENT_ROOT'].'/_website_scripts/includes/db.php');

// Open Database
if (!is_resource($conn_website)) $conn_website = conn_website();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>

<script type="text/javascript">

$(document).ready(function($){

$("select#make").change(function(){
$("#vehicle_code").html('');
$("#code").val('');
if (document.getElementById('make').value > '') {
$.getJSON("https://www.dobinsonsprings.com/_website_scripts/vehicle_code/getType.php",{
vehicle_make: document.getElementById('make').value,
ajax: 'true'},
function(j){
var options = '<option value="" selected>Please Select Type First...</option>';
$("select#model").html(options);
var options = '<option value="" selected>Please Select Type First...</option>';
$("select#description").html(options);
var options = '<option value="" selected>Please Select Type...</option>';
for (var i = 0; i < j.length; i++)
{
options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
}
$("select#type").html(options);
if (j[0].optionValue > '') {
$.getJSON("https://www.dobinsonsprings.com/_website_scripts/vehicle_code/getModel.php",{
vehicle_make: document.getElementById('make').value,
vehicle_type: document.getElementById('type').value,
ajax: 'true'},
function(j){
var options = '<option value="" selected>Please Select Type First...</option>';
for (var i = 0; i < j.length; i++)
{
options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
}
$("select#model").html(options);
})
}
})
} else {
var options = '<option value="" selected>Make</option>';
$("select#type").html(options);
$("select#model").html(options);
$("select#description").html(options);
}
})

$("select#type").change(function(){
$("#vehicle_code").html('');
$("#code").val('');
if (document.getElementById('type').value > '') {
$.getJSON("https://www.dobinsonsprings.com/_website_scripts/vehicle_code/getModel.php",{
vehicle_make: document.getElementById('make').value,
vehicle_type: document.getElementById('type').value,
ajax: 'true'},
function(j){
var options = '<option value="" selected>Please Select Model First...</option>';
$("select#description").html(options);
var options = '<option value="" selected>Please Select Model...</option>';
for (var i = 0; i < j.length; i++)
{
options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
}
$("select#model").html(options);
if (j.length == 0){
// Get vehicle_code
$.getJSON("https://www.dobinsonsprings.com/_website_scripts/vehicle_code/getCode.php",{
vehicle_make: document.getElementById('make').value,
vehicle_type: document.getElementById('type').value,
vehicle_model: '',
ajax: 'true'},
function(j){
var options = '';
var data = j[0].optionValue;
data = data.replace("\u2029", "");
if (data > '') options = data;
$("#vehicle_code").html(options);
$("#code").val(options);
})
}
})
} else {
var options = '<option value="" selected>Please Select Type First...</option>';
$("select#model").html(options);
$("select#description").html(options);
}
})

$("select#model").change(function(){
$("#vehicle_code").html('');
$("#code").val('');
if (document.getElementById('model').value > '') {
$.getJSON("https://www.dobinsonsprings.com/_website_scripts/vehicle_code/getDescription.php",{
vehicle_make: document.getElementById('make').value,
vehicle_type: document.getElementById('type').value,
vehicle_model: document.getElementById('model').value,
ajax: 'true'},
function(j){
var options = '<option value="" selected>Please Select Description...</option>';
for (var i = 0; i < j.length; i++)
{
options += '<option value=\'' + j[i].optionValue + '\'>' + j[i].optionDisplay + '</option>';
}
$("select#description").html(options);
if (j.length == 0){
// Get vehicle_code
$.getJSON("https://www.dobinsonsprings.com/_website_scripts/vehicle_code/getCode.php",{
vehicle_make: document.getElementById('make').value,
vehicle_type: document.getElementById('type').value,
vehicle_model: document.getElementById('model').value,
vehicle_description: '',
ajax: 'true'},
function(j){
var options = '';
var data = j[0].optionValue;
data = data.replace("\u2029", "");
if (data > '') options = data;
$("#vehicle_code").html(options);
$("#code").val(options);
})
}
})
} else {
var options = '<option value="" selected>Please Select Model First...</option>';
$("select#description").html(options);
$("#vehicle_code").html('');
$("#code").val('');
}
})

$("select#description").change(function(){
$("#vehicle_code").html('');
$("#code").val('');
if (document.getElementById('description').value > '') {
// Get vehicle_code
$.getJSON("https://www.dobinsonsprings.com/_website_scripts/vehicle_code/getCode.php",{
vehicle_make: document.getElementById('make').value,
vehicle_type: document.getElementById('type').value,
vehicle_model: document.getElementById('model').value,
vehicle_description: document.getElementById('description').value,
ajax: 'true'},
function(j){
var options = '';
var data = j[0].optionValue;
data = data.replace("\u2029", "");
if (data > '') options = data;
$("#vehicle_code").html(options);
$("#code").val(options);
})
} else {
var options = '<option value="" selected>Please Select Description...</option>';
$("#vehicle_code").html('');
$("#code").val('');
}
})

});

</script>
</head>
<body>
<!-- Paqe Body -->
<div style="width: 600px; margin:0 auto;">
<form id="form" name="form" method="post" action="https://www.dobinsonsprings.com/index.php/queue/vm-category">
<input type="hidden" name="code" id="code" value="">
<table cellpadding="5" cellspacing="5">
<tr>
<td width="400">
<select name="make" id="make">
<option value="" selected>Make</option>
<?php
$query ="SELECT * FROM qvp13_vehiclecategories_vehicles GROUP BY vehicle_make ORDER BY vehicle_make";
$result = mysqli_query($conn_website, $query);
while ($row = mysqli_fetch_assoc($result)) {
?>
<option value="<?php echo (addslashes($row['vehicle_make'])); ?>"><?php echo (addslashes($row['vehicle_make'])); ?></option>
<?php
}
?>
</select>
</td>
<td width="400">
<select name="type" id="type">
<option value="" selected>Type</option>
</select>
</td>
<td width="400">
<select name="model" id="model">
<option value="" selected>Model</option>
</select>
</td>
<td width="400">
<select name="description" id="description">
<option value="" selected>Description</option>
</select>
</td>
</tr>
<tr>
<td align="right">&nbsp;</td>
<td>&nbsp;</td>
<td><div id="vehicle_code" hidden></div></td>
<td align="right">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td align="right">&nbsp;</td>
<td><input type="submit" id="submit" name="submit" value="Go!"></td>
</tr>
</table>
</form>
</div>
<!-- End Page Body -->
</body>
<?php
// Close Database
mysqli_close($conn_website);
?>
</html>

 

{/source}