It's working great now (almost). I have another problem now maybe you can help.
What is occuring is a table is created by pulling certin fields from a database. The information from the database is then used to populate the drop down box in the last field.
If there is more than one row in the table what ever the value is for the last row is what is used to populate every drop down box on the screen. This of couse is not what I'm trying to do.
I have tested the query and the loop and I get all the values that I need but they are not being used by the loop to populate the drop down boxes correctly. If you can please take a look at the code I have. I think it has to do with nested loops and possible using an array to store the results, but can't figure it out.
Here is the code.
//query Product table begins to get correct value for drop down box
$query = mysql_query("SELECT * FROM `Product` WHERE Cat_Index = '$cat' and Sub_Cat = '$cat3' ");
//pull the value to pass to drop down box
if ($row = mysql_fetch_array($query))
{
$price = $row["Item_Num"];
}
// Get data from price table for drop down box
$quer1=mysql_query("SELECT * FROM `Price` WHERE Item_Num = '$price' ");
// Creat drop down box
$strDrop = '<select name="price" onchange="reload(this.form)">';
if ($row = mysql_fetch_array($quer1))
{
$strDrop .= '<option value="' .$row['Price']. '">' .$row['Desc']. ' $' .$row['Price']. '</option>';
}
$strDrop .= '</select>';
//query product table second time for the rest of the display
$query2 = mysql_query("SELECT * FROM `Product` WHERE Cat_Index = '$cat' and Sub_Cat = '$cat3' ");
while ($row = @mysql_fetch_array($query2))
{
$variable1=$row["Pic"];
$variable2=$row["Item_Num"];
$variable3=$row["Name"];
$variable4=$row["Short_Des"];
//table layout for results
print ("<tr align=\"center\">");
print ("<td><img src=\"images/products/$variable1.jpg\" height=\"64\" width=\"64\"></td>");
print ("<td>$variable2</td>");
print ("<td>$variable3</td>");
print ("<td>$variable4</td>");
print ("<td>$strDrop</td>");
print ("<td><form target=\"paypal\" action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\">
<input type=\"hidden\" name=\"cmd\" value=\"_ext-enter\">
<input type=\"hidden\" name=\"redirect_cmd\" value=\"_xclick\">
<input type=\"hidden\" name=\"business\" value=\"*..*\">
<input type=\"hidden\" name=\"item_name\" value=\"$variable3\">
<input type=\"hidden\" name=\"currency_code\" value=\"USD\">
<input type=\"hidden\" name=\"amount\" value=\"$cat4\">
<input type=\"image\" src=\"http://www.paypal.com/en_US/i/btn/x-click-but01.gif\" name=\"submit\" alt=\"Secure payments by paypal\">
</form></td>");
print ("</tr>");
}
//end
?>