Posting a form to another site


I am trying to post a form over to paypal to allow people to pay for goods from my site.

I am concerned that people are able to change the price or set up fake payments so I am trying to post the details through a php script, picking up and saving info through a database to improve security.

I am having problems directing users to paypal as I am trying to post all the data to their site thought a script. I have tried the header() commands with out any luck.

Can anyone please help me out?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

IPN sends you the details of the transaction it is then your job, to check that the price it correct before validating the order.
I'll post code in a sec
Here is something that might help you:

But I would recommend that you read:
before you continue, as it explains (and gives some code) about what you need to do.
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

bigtamtAuthor Commented:
Hi mnb93, thanks

I am fine with the IPN stuff, I am just looking for the php code to allow the paypal checkout page to be displayed with all the correct payment details on it.

I am not wanting to use the html form to post the vars, I trying to get a script to compile the post data and automatically send the users to the paypal checkout.

Is there any way of doing this using headers(). I have tried loads of different ways using sockets and I am having no luck.

I think you missed the point.
After the transaction, PayPal redirects the user back to your site - PayPal POST data to your site.
So you can view the amount they paid and transaction IDs etc...

(I am not 100% sure how PayPal works, but I have developed many carts using Australian Banks, Westpac and St George/Bank SA and they all do this)

If the user does forge the form and pays less, thats their fault - they dont get any services.
Let them chase you for the refund (minus admin costs).

You can confirm that they paid using the PayPal data that is resubmitted.
neester is correct it passes the values (including the price via a post to a page that you have setup) it is then your responsibility to check that the price is ok.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bigtamtAuthor Commented:
Hello all

I see what you are both getting at.

If a user buys more that 1 item through the paypal cart what will the IPN return?

I would need to know each item they bought, how much of each one and the total cost they paid. My site will automatically credit their account (on my site) with credits allow them to use these whenever they like.

If the IPN cannot return all of the item names and the quantity of each I am unable to relay on the IPN to automatic process purchases.

Dose anyone know what the paypal cart IPN will return on a multi item purchase.

The way I worked it out before is, when they view click PAY.
and the result comes back in, I lock their shopping cart.
then compare what they paid, to what should of been paid.

If it matches up, i save their cart contents and use that as a reference to what they bought.
That isn't very hard to implement either.

If you need help let me know!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.