Here is a snippet of the code for an assignment for my web programming class. I have to use PHP and JQuery to read a delimited text file and display the products in one row of a table. I have to use JQuery's toggle function to be able to show/hide details (price, image, and name) of a few products. Everything seemed to work until I started entering the JQuery code in the division. I have to use $productId as the id for the <div> and I seem to be having some trouble passing the variables to JQuery. I would appreciate any help anyone could offer as I'm at an impasse. I've attached a screenshot of the desired outcome. Thank you.
echo "<h3>OUR PRODUCTS</h3>";
echo "<form name=\"shoppingCart\" action=\"checkOut.php\" method=\"post\">
<input type=\"button\" value=\"CHECK OUT\" onclick=\"document.shoppingCart.submit()\">
<input type=\"button\" value=\"MAIN MENU\" onclick=\"location='/'\">
<!--For aesthetic purposes only-->
<button type=\"button\">INSTRUCTIONS</button>
</form>";
echo "<p>Click a product name for details and to order it. After selecting
products click CHECK OUT.</p>";
echo "<table>";
echo "<tr>";// open data file in read only mode
$productsData = fopen("products.txt","r");// parse file in while loop and generate product info
while(!feof($productsData)) {
$row=fgets($productsData);
$row=trim($row);
$productArray = explode("^",$row);
$productId = $productArray[0];
$productName = $productArray[1];
$productPrice = $productArray[2];
$productImageUrl = $productArray[3];
echo "<td width=\"220\" valign='top'>";
echo "<span style=\"font-weight: bold; font-size: 20px;\"
onclick=\"$('#$productId').animate({height: 'toggle'}, 'slow' );\">$productName</span>";
echo "</td>";
echo "<td valign='top'>
<div id=\"<?php echo($productId); ?>\" style=\"padding: 10px; display: none; font-weight: bold;\">
<img style=\"width: 200px;\" src=\"<?php echo($productImageUrl); ?>\">
<br>
Send me:
<select name=\"<?php echo($productId); ?>\">
<option value=\"0\">None</option>
<option value=\"1\">1</option>
<option value=\"2\">2</option>
<option value=\"3\">3</option>
</select>
</div>";
echo "</td>";
};// close data file
fclose($productsData);echo "</tr>";
echo "</table>";