hi,
i would like to submit two forms in one or some how combine them..
i need to...
a)add the shopping cart to a database
b)forward the item and total price to paypal
All With one submit button.
the part a ...
<?php
session_start();
$rs = mysql_connect( "xxx" );
$rs = mysql_select_db( "xxx" );
$cart = $_SESSION['cart'];
$total = $_SESSION['total'];
$user = $_SESSION['myusername'];
$final = serialize($cart);
$now_date = date( "D dS M,Y h:i a Z", time()+3600 );
$sql = "INSERT INTO orders (items,total,user,time) VALUES ('$final','$total','$user','$now_date')";
$rs = mysql_query( $sql ) or die('Query:<br />' . $sql . '<br /><br />Error:<br />' . mysql_error());
$data = mysql_query("SELECT * FROM orders WHERE items='$final' and total='$total' and user='$user'") or die(mysql_error());
$info = mysql_fetch_array( $data );
$id = $info['order_id'];
$_SESSION["id"] = $id;
unset($_SESSION['cart']);
header("location:pay.php");
?>
part B...
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" style="display:inline">
<input type="hidden" name="cmd" value="_xclick" />
<input name="return" type="hidden" id="return" value="http://example.com/cart/ordercompleted.php" />
<input type="hidden" name="business" value="sales@example.co.uk" />
<input type="hidden" name="item_name" value="Order..." />
<input type="hidden" name="amount" value="<?php echo $total_price; ?>" />
<input type="hidden" name="currency_code" value="GBP" />
<input type="hidden" name="shipping" value="0.00">
<input type="hidden" name="no_shipping" value="2">
<input type="image" name="submit" src="/images/checkout.png" alt="Pay Now" />
</form>