Page 1 of 1

html form with php, please help

Posted: Sun Jul 13, 2008 5:57 pm
by swissbeets
i neede this information to be passed to google checkout but i am not as good with html as php and not quit sure of all the rules

i am not getting a hyperlink when i click on the picture so i know something is wrong, please let me know if you see it


sorry i wasnt quite sure how to tag this since its in and out of php and html so much

Code: Select all

 
 
 
$product_set = get_cart($cookie_id);
while($row = mysql_fetch_array($cart_set))
    {
<form method="POST"
  action="https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/************"
      accept-charset="utf-8">
 
 
<----as you can see below this i have name="item_name_"++  this is because i need the item_name_ to go up as we go through this while loop(this is also the same with all of the variables)--->
 
  <input type="hidden" name="item_name_"++ value="<?php echo $row['product_id']; ?>"/>
 
  <input type="hidden" name="item_quantity_1" value="<?php echo $row['qty']; ?>"/>
  <input type="hidden" name="item_price_1" value="<?php echo $row['product_price']; ?>"/>
  <input type="hidden" name="item_currency_1" value="USD"/>
 
  <input type="hidden" name="ship_method_name_1" value="UPS Ground"/>
  <input type="hidden" name="ship_method_price_1" value="10.99"/>
 
  <input type="hidden" name="tax_rate" value="0.0875"/>
  <input type="hidden" name="tax_us_state" value="NY"/>
 
  <input type="hidden" name="_charset_"/>
 
  
<?php
 
}
?>
<input type="image" name="Google Checkout" alt="Fast checkout through Google"
src="http://checkout.google.com/buttons/checkout.gif?merchant_id=*************&w=180&h=46&style=white&variant=text&loc=en_US"
height="46" width="180"/>
</form>
 

Re: html form with php, please help

Posted: Mon Jul 14, 2008 6:15 am
by sureshmaharana
Try this one:

# <form method="POST" name="checkout"
# action="https://checkout.google.com/api/checkou ... /Merchant/************"
# accept-charset="utf-8">






# <input type="image" name="Google Checkout" alt="Fast checkout through Google"
# src="http://checkout.google.com/buttons/chec ... &loc=en_US"
# height="46" width="180"/ onClick="submitForm()">


And before closing <head> tag write this one:
function submitForm()
{
document.checkout.submit();
}

Re: html form with php, please help

Posted: Mon Jul 14, 2008 12:37 pm
by swissbeets
ok i believe i have the correct code now btu when i click to add the items to a shopping cart for some reason it asks me where i would like to save the picture
(the google checkout picture)

this code works when there is only one item but not any more? i cannot figure why?

Code: Select all

 
   $cart_set1 = get_cart($cookie_id);
while($row = mysql_fetch_array($cart_set1))
    {?>
<?php 
$number=1;
?>
<form method="POST"
    action="https://sandbox.google.com/checkout/api/checkout/v2/checkoutForm/Merchant/722419656118816">
 
  <input type="hidden" name="<?php echo "item_name_".$number; ?>" value="<?php echo $row['product_name']; ?>"/>
 
  <input type="hidden" name="<?php echo "item_quantity_".$number; ?>" value="<?php echo $row['qty']; ?>"/>
  <input type="hidden" name="<?php echo "item_price_".$number; ?>" value="<?php echo $row['product_price']; ?>"/>
  <input type="hidden" name="<?php echo "item_currency_".$number; ?>" value="USD"/>
  <input type="hidden" name="<?php echo "ship_method_name_".$number; ?>" value="UPS Ground"/>
  <input type="hidden" name="<?php echo "ship_method_price_".$number; ?>" value="10.99"/>
  <input type="hidden" name="<?php echo "item_description_".$number; ?>" value="<?php echo $row['size']; ?>"/>
  <input type="hidden" name="tax_rate" value="0.0875"/>
  <input type="hidden" name="tax_us_state" value="NY"/>
  <input type="hidden" name="_charset_"/>
 
 
<?php 
$number++;
?>
 
 
<?php
 
}
?>
 
 <input type="image" name="Google Checkout" alt="fast checkout through google"
src="http://checkout.google.com/buttons/checkout.gif?merchant_id=722419656118816&w=180&h=46&style=white&variant=text&loc=en_US"
height="46" width="180"/>
</form 
 

Re: html form with php, please help

Posted: Mon Jul 14, 2008 4:20 pm
by swissbeets
i got it working but have no idea what the error was