0
我有購物車頁面中的文本框是爲了更新數量存在,我正在使用jquery來收聽點擊事件&獲取productid &的值的文本框。 Productid我越來越好,但文本框的值始終是第一個文本框中的值。更新從第一個文本框中獲取值的文本框的值只有
這裏是車文件的代碼
echo "<tr>";
echo "<th><img src=".$row["image_location"]."></th>";
echo "<th>".$row["product_name"]."</th>";
echo "<th><input type='text' id='quantity' name='quantity' required='required' autocomplete='off' value=".$row["quantity"].">";
echo " ";
echo $row["type"]."</th>";
echo "<th>".$row["price"]."</th>";
echo "<th>"."₹ ".$subtotal."</th>";
echo "<th><div class='buttoncircle' id='".$row["productid"]."'>Update</div></th>";
echo "<th><a href='removefromcart.php?productid={$row["productid"]}' class='buttoncircle' style='margin-left:-65px'>Remove</a></th>";
echo "</tr>";
這裏是Javascript代碼。
<script>
$('.buttoncircle').live('click',function() {
var productid = $(this).attr('id');
var quantity = $('#quantity').val();
window.open('db_changequantity.php?quantity='+quantity+'&productid='+productid,'_self');
});
誰能幫助從只有第一個調用特定的文本框&沒有價值?
這是URL:db_changequantity.php量=未定義&的productid = 32? 查看未精訂的數量?? –
你的mozila瀏覽器中有firebig嗎?請檢查'id ='quantity _「。$ row [」productid「]。」''它在源碼 –
'id = quantity _「中正確顯示爲紅色。$ row [」productid「]'你可以在qty字段中替換這個嗎? –