Hi All, I am trying to pass the value from drop down menu generated from the database and I am trying to pass the value from the first drop down selection to the next the value in red is the variable. I have tried the $category_id=$nt; $category_id=$_GET; but this does not seem to work. the value cannot be found in the next SQL query.
Thanks in advance
//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>";