Hi i have the following working code which i can select a manufacturer from a drop down box. This works fine however i want to create another drop down box called model_type which has data in another recordset.
When i select a value from the manufacturer drop down i want the model_type dropdown to display models for that manufacturer. Hope this makes sense.. !! Ultimatly after selecting a manufacturer and model_type, etcc a unique code will be available to pass to another page..
Hope this is somthing easy to do!
Many thanks,
Brian
When i select a value from the manufacturer drop down i want the model_type dropdown to display models for that manufacturer. Hope this makes sense.. !! Ultimatly after selecting a manufacturer and model_type, etcc a unique code will be available to pass to another page..
Code:
<?php require_once('Connections/yardbuying.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_yardbuying, $yardbuying);
$query_Recordset1 = "SELECT Manufacturer FROM vehicles GROUP BY Manufacturer ORDER BY Manufacturer Asc";
$Recordset1 = mysql_query($query_Recordset1, $yardbuying) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
</select>
<form id="form1" name="form1" method="post" action="">
<label>
<select name="Manufacturer" id="Manufacturer">
<?php
do {
?>
<option value="<?php echo $row_Recordset1['Manufacturer']?>"><?php echo $row_Recordset1['Manufacturer']?></option>
<?php
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
$rows = mysql_num_rows($Recordset1);
if($rows > 0) {
mysql_data_seek($Recordset1, 0);
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
}
?>
</select>
</label>
</select>
</label>
</form>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
Hope this is somthing easy to do!
Many thanks,
Brian