Jump to content

Recommended Posts

<?php

require_once('db.inc.php');
if($_SESSION['cart']) {


$i = 1;
echo '<br />';
echo '<br />';
echo '<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" style="margin:0px;" method="post">';
echo '<table class="iteminfo" align="center"><th>Quantity</th><th>Product(s)</th><th>Unit Price</th><th>Total Price</th>';
foreach($_SESSION['cart'] as $product_id => $quantity) {

$getiteminfo = mysql_query(sprintf("SELECT ItemName, ItemPrice FROM `***` WHERE `ItemId` = %d;", $product_id))or die (mysql_error());
if (mysql_num_rows($getiteminfo) > 0) {
list($Name, $ItemPrice) = mysql_fetch_row($getiteminfo);


$color1='#bebeb1';
$color2='#eaeada';

$bgcolor=($bgcolor==$color1)?$color2:$color1; 


$line_cost = 0.00;
$line_cost = $ItemPrice * $quantity; 
$total = $total + $line_cost; 


echo '<tr bgcolor="'.$bgcolor.'"><td style="height:75px;><form style="margin:0px;" action="" method="post"><input type="text" class="quantity" name="amount" size="3" value="'.$quantity.'" /><br /><input type="button" onClick="updateItem(\''.$product_id.'\',amount.value, \''.$Name.'\')" class="update" value="Update!" /><br /><input type="button" onClick="removeItem(\''.$product_id.'\', \''.$Name.'\')" class="update" value="Remove!" /></form></td>';
echo '<td style="width:300px;text-align:left;"><img src="http://www.site.com/Images/Nauren.jpg" alt="'.$Name.'" class="view" align="top" />'.$Name.'</td><td align="center">$'.$ItemPrice.'</td>';

echo '<td align="center">$'.number_format($line_cost, 2).'</td></tr>';
echo '<input type="hidden" name="quantity_'.$i.'" value="'.$quantity.'" /><input type="hidden" name="amount_'.$i.'" value="'.number_format($ItemPrice, 2).'" /><input type="hidden" name="item_name_'.$i.'" value="'.$Name.'" />';

$i++;
}

}

echo '<tr><td colspan="3" align="right">Total Price:</td><td>$'.number_format($total, 2).'</td></tr>';
echo '<tr><td colspan="4" style="text-align:right;"><input type="hidden" name="business" value="" /><input type="hidden" name="cmd" value="_cart" /><input type="hidden" name="upload" value="1"><input type="image" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" /></td></tr>';
echo '</table>';
echo '</form>';
} else {
echo 'You have no Items in your cart';
}
?>

This works in Chrome, Firefox, but in IE, the form tag in the td makes the rest of the tds in the table row go down for the first item. It also doesn't let the form surrounding the table to submit in IE, but it does in the others. Any help would be greatly appreciated. Thanks.

Link to comment
https://forums.phpfreaks.com/topic/191977-stumped-on-these-form-submits/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.