Initially I am populating my option tag with Quantity available in stock.
<select name="quantity" class="form-control input-sm" id="quantity">
<?php for ($i=1; $i<=$Quantity; $i++) { ?>
<option value="<?php echo $i;?>"><?php echo $i;?></option>
<?php } ?>
</select>
I am updating Quantity from my html form using Javascript:
function update_id(id)
{
if (confirm('Update quantity for this Item?')) {
uid = id;
quantity = $('select[name=quantity]').val()
window.location.href="Cart.php?update_id="+uid+"&quantity="+quantity;//+'?quantity='+quantity;
}
}
and storing it in Cart table against that particular product. On reloading or refreshing the page, option tag gets reset to default value here as '1'. I want to assign option tag value with the Updated Quantity from DB against that particular product.
Thanks in Advance
Aucun commentaire:
Enregistrer un commentaire