Hi David;
First let me gently suggest that the run-on sentences in your post make it hard to identify your problem. Clarity is critical when trying to explain what you need.
Also, your code needs to be in
[code=php] tags so we can read it clearly and respond quoting line numbers.
Please don't take offense, I'm trying to help ;-}
Having said that, it looks like in
<select name=category_id value=''> on line 9 you are trying to access a value from the database, but you haven't read a row yet, that doesn't happen till line 11, so the value is not yet accessible. You've read all the rows into an array on line 8, but you haven't actually started the loop that reads each row, that starts on line 11. That's what you need to do to access the values.
However, the name of the
<select> control doesn't normally come from a database unless you are trying to loop through the categories creating a select list from each, which is a whole different ball game. Doable, but different.
I'm sort of guessing here, because your question is not clear.
I hope that helps a little bit.
Cheers,
Rob
//Start of form
echo "<form action=\"cat.php\" method=\"post\">\n";
$query="SELECT category_id, category_name
FROM category ";
// start to read database values
$result = mysql_query ($query);
echo "<select name=category_id value=''><option> Select your category </option>";// printing the list box select command
while($nt=mysql_fetch_array($result))/* Option values are added by looping through the array */
{
echo "<option value=$nt[category_id]> $nt[category_name]</option>";//Array or records stored in $nt
}
echo "</select>";// Closing of list box */
echo "<br/>";
$category_id=$nt['category_id'];
$category_id=$_GET['category_id'];
$category_id=2;// here I default the value and the db produces the correct result
//$query="SELECT DISTINCT manufacturer_name, category_id
//FROM manufacturer
//";
$query="SELECT DISTINCT manufacturer.manufacturer_name
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' ";
// start to read database values
$result = mysql_query ($query);
echo "<select name=manufacturer_name value=''><option> Select your category </option>";
// printing the list box select command
while($nt=mysql_fetch_array($result))
{ //Array or records stored in $nt
echo "<option value=$nt[manufacturer_id]> $nt[manufacturer_name]</option>";
/* Option values are added by looping through the array */
}
echo "</select>";// Closing of list box */
//Should this be capturing data from the highlighted red code?
echo"<input type=\"hidden\" name=\"make\" value=\"$make\">";// this value is know in the page
// echo"<input type=\"hidden\" name=\"category_id\" value=\"$category_id\">";// this value is know in the page
echo "<br/>";
echo "<br/>";
echo" <input type=\"submit\" value=\"Search\">\n";
echo"</form>";