I have a cart that has hidden fields that I want to pass to paypal. It is passing one variable at a time only. How do I fix this? Can I use a for loop, if so can I please have an example? The code is as follows
Code:
<form name="frmCart" method="get" action="[URL unfurl="true"]https://www.paypal.com/cgi-bin/webscr">[/URL]
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="chris.n@vacuumshop.com.au">
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr class="green">
<td width="15%" height="25">
Qty
</td>
<td width="55%" height="25">
Product
</td>
<td width="15%" height="25" >
Price Each
</td>
<td width="15%" height="25" >
Remove Item </td>
</tr>
<?php
while($row = mysql_fetch_array($result))
{
// Increment the total cost of all items
$totalCost += ($row["qty"] * $row["itemPrice"]);
?>
<tr>
<td width="15%" height="25">
<select name="<?php echo $row["itemId"]; ?>" onChange="UpdateQty(this)">
<?php
for($i = 1; $i <= 20; $i++)
{
echo "<option ";
if($row["qty"] == $i)
{
echo " SELECTED ";
}
echo ">" . $i . "</option>";
}
?>
</select>
<input type="hidden" name="quantity_1" value="<?php echo $row["qty"];?>">
</td>
<td width="55%" height="25">
<?php echo $row["item_name"]; ?>
<input type="hidden" name="item_name_1" value="<?php echo $row["item_name"]; ?>">
</td>
<td width="20%" height="25">
$<?php echo number_format($row["itemPrice"], 2, ".", ","); ?>
<input type="hidden" name="amount_1" value="<?php echo number_format($row["itemPrice"], 2, ".", ","); ?>">
</td>
<td width="10%" height="25">
<a href="cart.php?action=remove_item&id=<?php echo $row["itemId"]; ?>">Remove</a>
</td>
</tr>
<?php
}
// Display the total
?>
<tr>
<td width="100%" colspan="4">
<hr />
</td>
</tr>
<tr>
<td width="70%" colspan="2">
</td>
<td width="30%" colspan="2">
<b>Total: $<?php echo number_format($totalCost, 2, ".", ","); ?></b>
</td>
</tr>
</table>
<table width="100%" border="0" cellpadding="2">
<tr>
<td> </td>
<td>
<input type="hidden" name="currency_code" value="AUD">
<input type="image" src="[URL unfurl="true"]https://www.paypal.com/en_US/i/btn/x-click-but23.gif"[/URL] border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<img alt="" border="0" src="[URL unfurl="true"]https://www.paypal.com/en_AU/i/scr/pixel.gif"[/URL] width="1" height="1">
</form>