HTML Code:<form action='orderpplac.php' method='Post' class='shlistbar'> <table border='1'> <tr> <th>SHOP NAME</th> <th>PRODUCT NAME</th> <th>PRODUCT SIZE</th> <th>PRODUCT COLOUR</th> <th>PRODUCT QUANTITY</th> <th>PRICE</th> <th>TOTAL</th> <th></th> </tr>PHP Code:<?php
// Get DB results and loop, outputting table rows with counter
$pplresult = mysql_query("SELECT * FROM repplac WHERE Uname = '{$_SESSION['username']}'") or die(mysql_error());
for ($i = 0; $row = mysql_fetch_assoc($pplresult); $i++) {
echo "
<tr>
<td>".htmlspecialchars($row['Sname'])."</td>
<td>".htmlspecialchars($row['Pname'])."</td>
<td>".htmlspecialchars($row['Psize'])."</td>
<td>".htmlspecialchars($row['Pcolour'])."</td>
<td>
<input type='text' name='item[$i][Pquantity]' id='Pquantity' value='".htmlspecialchars($row['Pquantity'])."' />
<input type='hidden' name='item[$i][Pidno]' id='Pidno' value='".htmlspecialchars($row['Pidno'])."' />
</td>
<td>
<input type='text' name='item[$i][Price]' id='Pquantity' value='".htmlspecialchars($row['Price'])."' readonly>
</td>
<td>".htmlspecialchars($row['Tprice'])."</td>
<td><a href='deleteproduct.php?del=".htmlspecialchars($row['Pidno'])."'>delete</a></td>
</tr>";
}
$pplresult = mysql_query("SELECT * FROM repplac WHERE Uname = '{$_SESSION['username']}'") or die(mysql_error());
while ($row = mysql_fetch_assoc($pplresult))
//echo $row['Pquantity'] * $row['Price'];
{
$totalPrices += $row['Tprice'];
if(0.1*$totalPrices <= 50 )
{
$totalPrice = (0.1*$totalPrices + $totalPrices);
}
else
{
$totalPrice = 50 + $totalPrices;
}
}
//echo "$totalprice";
?>HTML Code:<tr> <th>Total Price</th> <th><?php echo $totalprice; ?></th> </tr> <!--Close table and form--> </table> <input type='submit' name='submit1' value='UPDATE' /> <input type='submit' name='submit2' value='SUBMIT' /> </form>



Reply With Quote


Bookmarks