As you might know $id++
is equivalent to $id = $id + 1
. You are writing a new value into $id
all the time.
Simple, don't increment every time:
<?php
$id=1;
$sql = mysql_query("SELECT item_product,amount,quantity FROM products_added WHERE cookieid=$cookieid") or die(mysql_error());
while ($rows = mysql_fetch_array($sql)) {
$product = $rows['item_product'];
$amount = $rows['amount'];
$qty = $rows['quantity'];
?>
<input class="itemname" type="text" id="product_<?php echo $id;?>" value="<?php echo $product;?>">
<input class="itemamount" type="text" id="amount_<?php echo $id;?>" value="<?php echo $amount;?>">
<input class="itemqty" type="text" id="qty_<?php echo $id;?>" value="<?php echo $qty;?>">
$id++;
<?php } ?>