Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-17-2009, 02:17 AM   PM User | #1
danielwarner
Regular Coder

 
Join Date: Oct 2005
Location: Surrey, England
Posts: 286
Thanks: 2
Thanked 2 Times in 2 Posts
danielwarner is an unknown quantity at this point
Sending post vars using a redirect

What im looking for my script to do is retrieve information, store it in a database and then use that information to automatically post to paypal (for a buy now button).

So what i currently have is the form:
Code:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">

	<input type="hidden" name="cmd" value="_xclick">
	<input type="hidden" name="business" value="my@email.com">
	<input type="hidden" name="lc" value="GB">
	<input type="hidden" name="item_name" value="Donation">
	<input type="hidden" name="item_number" value="999">
	<input type="text" size="6" name="amount" value="5.00">
	<input type="hidden" name="currency_code" value="GBP">
	<input type="hidden" name="no_note" value="1">
	<input type="hidden" name="no_shipping" value="1">
	<input type="hidden" name="rm" value="1">
	<input type="hidden" name="return" value="http://example.com/payment_authorised.php">
	<input type="hidden" name="cancel_return" value="http://example.com/payment_cancelled.php">
	<input type="hidden" name="shipping" value="0.00">
	<input type="hidden" name="custom" value="1,25,65,888">
	<input type="hidden" name="bn" value="PP-BuyNowBF:btn_paynow_LG.gif:NonHosted">
	<input type="hidden" name="notify_url" value="http://example.com/ipn.php">
	<input type="image" src="https://www.paypal.com/en_GB/i/btn/btn_paynow_LG.gif" border="0" name="submit" alt="">
	<img alt="" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1"/>

</form>
What it does is replace the standard hidden input with a text input so a user can enter the value themselves. This is fine although I don't want the user to be able to enter a value below 2.00. I'm trying to do this without JavaScript so just pure php. I also have to customise the input "custom" based on the users input but that problem should be fixed with the same solution.

So what want to do is turn

[form] > [log information] > [display button] > [paypal]

into

[form] > [log information] -> [redirected to paypal]

Does anyone have any advice for this? I've browsed google but i either dont get the information im looking for or i similar peoples queries without a definite response or article.

Thanks.
__________________
Daniel Warner
- - - - - - - - - -
GuitarMart.co.uk - Free Online Classified Advertisement for Guitarists in the United Kingdom. Free Ads with a Free Photo.
danielwarner is offline   Reply With Quote
Old 01-17-2009, 03:26 AM   PM User | #2
kokjj87
Regular Coder

 
kokjj87's Avatar
 
Join Date: Sep 2008
Location: Singapore
Posts: 279
Thanks: 1
Thanked 55 Times in 54 Posts
kokjj87 is on a distinguished road
This is how you can Post a data manually.
PHP Code:
<?php
$host 
"www.example.com";
$path "/Path/script/"//path to the processing script
$data "variable1=value1&variable2=value2";
$data urlencode($data);

header("POST $path HTTP/1.1\r\n" );
header("Host: $host\r\n" );
header("Content-type: application/x-www-form-urlencoded\r\n" );
header("Content-length: " strlen($data) . "\r\n" );
header("Connection: close\r\n\r\n" );
header($data);
?>
kokjj87 is offline   Reply With Quote
Reply

Bookmarks

Tags
integration, paypal, post headers, redirect

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:27 PM.


Advertisement
Log in to turn off these ads.