Update Session Value in Php

 if($_REQUEST['command']=='update')
{
$max=count($_SESSION['cart']);
for($i=0;$i<$max;$i++){
$pid=$_SESSION['cart'][$i]['productid'];
$q=intval($_REQUEST['product'.$pid]);
if($q>0 && $q<=999)
{
$_SESSION['cart'][$i]['qty']=$q;
}
else
{
$msg='Some proudcts not updated!, quantity must be a number between 1 and 999';
}
}
}

<script type="text/javascript">

function update_cart(){
document.frm1.command.value='update';
document.frm1.submit();
}
</script>



<a class="btn btn-default update" href="javascript:update_cart();">Update</a>

Popular posts from this blog

Simple Sign up design. Android.

Cart page design in android.

Set Date on jDateChooser and retrieve record from database.