here is my code, the form at the bottom is the button that i want displayin after the lsat table has been displayed:
PHP Code:
<?php
$Connect = mysql_connect('localhost', '***', '***');
mysql_select_db('shadesofjapan', $Connect);
if ($_POST['RemoveItem'] == TRUE)
{
$Result = mysql_query("DELETE FROM shoppinglist WHERE AutoId ='" . $AutoIdForm . "'") or die (mysql_error);
}
if ($_POST['RemoveItem'] == TRUE AND $Result == TRUE)
{
?>
<script type="text/javascript">
alert ("Item Successfully Removed")
</script>
<?php
}
$Result = mysql_query("SELECT AutoId, ProductName, Finish, Size, Price, Quantity FROM shoppinglist WHERE UserId = '" . $_SESSION['UserId'] . "'") or die('Error: '.mysql_error());
if (mysql_num_rows($Result) != 0)
{
while ($MyRow = mysql_fetch_array($Result))
{
$AutoId = $MyRow['AutoId'];
$ProductName = $MyRow['ProductName'];
$Finish = $MyRow['Finish'];
$Size = $MyRow['Size'];
$Price = $MyRow['Price'];
$Quantity = $MyRow['Quantity'];
$Result1 = mysql_query("SELECT sum(Price)as Price FROM shoppinglist WHERE UserId = '" . $_SESSION['UserId'] . "'");
while ($MyRow1 = mysql_fetch_array($Result1))
{
$TotalPrice = $MyRow1['Price'];
$EntryPrice = number_format($TotalPrice, 2);
}
?>
<form name="form1" method="post" action="">
<table width="607" height="197" border="0">
<tr>
<td><h2>Product Name: <font color="#FF0000"><? echo $MyRow['ProductName']; ?></font></h2> </td>
</tr>
<tr>
<td><h2>Finish: <font color="#FF0000"><? echo $MyRow['Finish']; ?></font></h2> </td>
</tr>
<tr>
<td><h2>Size: <font color="#FF0000"><? echo $MyRow['Size']; ?></font></h2> </td>
</tr>
<tr>
<td><h2>Price: £<font color="#FF0000"><? echo $MyRow['Price']; ?></font></h2> </td>
</tr>
<tr>
<td><h2>Quantity: <font color="#FF0000"><? echo $MyRow['Quantity']; ?></font></h2> </td>
</tr>
<tr>
<td height="83"><div align="center">
<input type="submit" name="RemoveItem" value="Remove Item">
</div></td>
</tr>
</table>
<p>
<input type='hidden' name='AutoIdForm' value='<? echo $AutoId; ?>' />
</form>
<?php
$AutoIdForm = $_POST['AutoIdForm'];
}
echo $EntryPrice;
}
else
{
echo"<center><h2>You have not selected any items to order</h2></center>";
}
?>
</div>
<div id="Layer5" style="position:absolute; left:196px; top:292px; width:607px; height:26px; z-index:5">
<div align="center">----------------------------------------------------------------------</div>
</div>
<div id="Layer6" style="position:absolute; left:2px; top:2px; width:800px; height:167px; z-index:6"><img src="images/mainlogo.png" width="800" height="167"></div>
<div id="Layer7" style="position:absolute; left:192px; top:611px; width:607px; height:25px; z-index:7">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<div align="center">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="shadesofjapan@webnoob.com">
<input type="hidden" name="item_name" value="Items">
<input type="hidden" name="amount" value="<? echo $EntryPrice; ?>">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="GBP">
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</div>
</form>
</div>
</body>
</html>
Bookmarks