I have enclosed the main chunk of php and where it has been used within the html i have put the PHP code in bold hopefully this makes it easier to read.
Any input on the code would be much aprishiated 🙂
<?php
include ("constants.inc");
$connection = mysql_connect($GLOBALS['host'],$GLOBALS['user'],$GLOBALS['pass']) or die ("couldn't connect to server");
$db = mysql_select_db ($GLOBALS['db_name'], $connection) or die ("Unable to select the database");
$setquery = "SELECT paypal_name FROM settings WHERE clubid = 1";
$setres = mysql_query($setquery);
$setquery = mysql_fetch_assoc($setres);
$setquery = $setquery['paypal_name'];
$stockquery = "SELECT * FROM stock ORDER BY itemid";
$stockres = mysql_query($stockquery);
while ($row = mysql_fetch_row($stockres, MYSQL_BOTH)) {
<html>
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<table><tr><td><input type="hidden" name="on0" value="Size">Size</td><td><select name="os0"><option value="xx-small">xx-small<option value="x-small">x-small<option value="small">small<option value="medium">medium<option value="large">large<option value="x-large">x-large<option value="xx-large">xx-large<option value="xxx-large">xxx-large</select>
</td></tr></table><input type="image" src="https://www.paypal.com/en_GB/i/btn/x-click-but22.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<input type="hidden" name="add" value="1">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value=<?php $setquery['paypal_name']; ?>>
<input type="hidden" name="item_name" value=<?php $stockquery['name']; ?>>
<input type="hidden" name="item_number" value=<?php $stockquery['itemid']; ?>>
<input type="hidden" name="amount" value=<?php $stockquery['guest_price']; ?>>
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="return" value="http://www..someurl.com">
<input type="hidden" name="cancel_return" value="http://www.someurl.com">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="lc" value="GB">
<input type="hidden" name="bn" value="PP-ShopCartBF">
</form>
</html>
}
mysql_free_result($setres);
mysql_free_result($stockres);
?>