Method 1:
http://www.plus2net.com/php_tutorial/variables2.php

Method 2:

You can use this method also to transfer product id to cart page

<td><a href="cart.php?ProductId=<?php echo $row[ProductId]; ?>">Add Item</a></td>

Then on cart.php page you can get ProductId using $_REQUEST['ProductId'] variable and further run a database query using this id for other fields from table.