All you need to do is have your script output the form with the fields filled out properly, like

<body onload="document.myform.submit()"> <form action="the paypal url" name="myform" method="post"> <input type="hidden" name="some paypal form key" value="the correspond +ing value"> <input type="submit" value="click here to continue">

If the user has JavaScript enabled, they probably won't notice the redirect.

Edit: It seems people are misunderstanding what I wrote. OP's problem, as I understood it, was that their script needs to add items to their user's PayPal cart. PayPal has a way of doing this, which involves putting a form on your webpage for the user to click on. Perhaps OP needs to look up the product ID or something, so just using the default form won't work. Here's what PayPal suggests you put on your page. Those hidden fields are already filled out. The only thing the user would see is the "Add to cart" button. My suggestion was to have OP's script fill out those fields as they should be anyways, and then to "click" the button for the user, to streamline the buying process.

-Thomas
"Excuse me for butting in, but I'm interrupt-driven..."

In reply to Re: Post cart data to paypal by thomas895
in thread Post cart data to paypal by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.