Jump to content

[SOLVED] form posting, can i do this?


swissbeets

Recommended Posts


$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>

 

the image is not even working as a link that is why i think there is a problem

Link to comment
Share on other sites

As haku said, a bit more info would be helpful.

 

However, towards the end of your code you have

<?php

}
?>

 

At the top of your code you have

while($row = mysql_fetch_array($cart_set))
    {

which then goes into htnl - you haven't closed the php code with ?>.

 

Maybe that's the problem?

Link to comment
Share on other sites

sorry about that, i am putting this information into google checkout and need certain things to be posted, i think. i am having a terrible time trying to work with google checkout i am saving all of my information for my cart into a db and only need to query the database and send this info to google when the person clicks submit. i took this fromm the sample and added my own information to it.

 

my problem is i need that to be looped through and post all the information to google, i am assuming that in order for google to tell that they are seperate items, the item number must increment.  but i dont know that much html and was hoping i was just making the form do something that was not allowed in html and someone would pretty easily see it.

Link to comment
Share on other sites

ok i believe i have the correct code now but for some reason when i click the link, it brings up that i am downloading the picture (the google checkout picture)

 

i cannot figure this out, especially since it worked before i added more items

 

here is my code

 

   $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 

 

any ideas?

Link to comment
Share on other sites

Just incase you can't get more than one item in this way its caused by your php...

 

  $cart_set1 = get_cart($cookie_id);
$number=1;
while($row = mysql_fetch_array($cart_set1))



{?>
<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>

Link to comment
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.