I am trying to populate a dropdown list using <select><option> and on the selected option pass the values to another page. I have been trying a lot of things over the las two days and I have finally decided to go to the community for assistance. The data is displayed in the option box but I am bogged down when trying to pass the values to the next page. I am using post to capture the data.
The code I am trying to use at this is as follows, if you need any further info please let me know.
Thanks in advance
DJ
$query="SELECT DISTINCT vehicles.vehicles_model, manufacturer.manufacturer_name, vehicles.vehicles_year
FROM category as category
JOIN vehicles as vehicles on category.category_ID = vehicles.FK_category_ID
JOIN products as products on products.products_id = vehicles.FK_products_ID
JOIN manufacturer as manufacturer on manufacturer.manufacturer_ID = vehicles.FK_manufacturer_ID
WHERE vehicles.FK_category_ID = '$category_id' and manufacturer_name='$make'";
// read database values
$result = mysql_query ($query);
echo "<select name=vehicles_model value=''><option>Select your vehicle</option>";
// printing the list box select command
while($nt=mysql_fetch_array($result)){//Array or records stored in $nt
echo "<option value=$nt[vehicles_id]>Model: $nt[vehicles_model] Year: $nt[vehicles_year]</option>";
/* Option values are added by looping through the array */
echo $id = $nt['vehicles_id'];
}
echo "</select>";// Closing of list box
$id = $nt['vehicles_id'];
$name = $nt['manufacturer_name'];
$model = $nt['vehicles_model'];
echo "<form action=\"cat.php\" method=\"post\">\n";
echo"<input type=\"hidden\" name=\"manufacturer_name\" value=\"$make\">";
echo"<input type=\"hidden\" name=\"vehicles_model\" value=\"$model\">";
echo"<input type=\"hidden\" name=\"vehicles_pointer\" value=\"$category_id\">";
echo"<input type=\"submit\" value=\"Search\">\n";
echo"</form>";
echo $model;