How can i reduce stock quantity in database after checkout?and if no item then show no item available. Here is my code.Plz help | SoloLearn: Learn to code for FREE!

0

How can i reduce stock quantity in database after checkout?and if no item then show no item available. Here is my code.Plz help

<?php $total = 0; $bill=0; $sno=1; foreach($_SESSION as $products){ $p=0; $q=0; echo "<tr>"; echo "<td>".($sno++)."</td>"; echo "<form action='editCart.php' method='POST'>"; foreach($products as $key => $value){ if( $key ==3){ echo "<td> <input type='text' name='name$key' class='form-control' value='".$value."'></td>"; $q=$value; } else if($key==2){ echo "<input type='hidden' name='name$key' value='".$value."'>"; echo "<td> " .$value. "</td>"; $p=$value; } else if($key==1){ echo "<input type='hidden' name='name$key' value='".$value."'>"; echo "<td> " .$value. "</td>"; } else if($key==0){ echo "<input type='hidden' name='name$key' value='".$value."'>"; echo "<td> " .$value. "</td>"; } } $bill=($q*$p); echo "<td> " .$bill. "</td>"; echo "<td><input type='submit' name='event' value='Update' class='btn btn-warning'></td>"; echo "<td><input type='submit' name='event' value='Delete' class='btn btn-danger'></td>"; echo "</tr>"; echo "

5/1/2020 4:46:11 PM

Christina Jessy

0 Answers

New Answer