The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> PayPal checkout and PHP
tudsy
post Aug 4 2022, 03:48 AM
Post #1


Advanced Member
****

Group: Members
Posts: 227
Joined: 30-September 14
Member No.: 21,611



Hi

I am trying to process transactions using PayPal SDK. I also want to pass php variables to the PayPal code found on their (PayPal) website.

Attached is process1.txt(php) which has the php and the paypal code for a paypal button inside.


Any help will be appreciated.

Thanks. biggrin.gif


Attached File(s)
Attached File  process1.txt ( 5.64k ) Number of downloads: 7
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Aug 4 2022, 07:13 PM
Post #2


Programming Fanatic
********

Group: Members
Posts: 1,913
Joined: 27-April 13
From: Edinburg, Texas
Member No.: 19,088



If this is a paypal process script 'process1.txt(php)' then why all the javascript? PHP (server side scripting) can't run javascript, only the browser can (that's why it's called client side scripting). Javascript can call a PHP script but only if you use AJAX.

Do you want the form to submit when the paypal button is clicked?
Or, do you want the form to stay in place when the paypal button is clicked?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
tudsy
post Aug 5 2022, 08:11 AM
Post #3


Advanced Member
****

Group: Members
Posts: 227
Joined: 30-September 14
Member No.: 21,611



Hi

Thanks for that.

When the form is submitted and the PayPal button is clicked, I want the Price, Graphic and url information appearing in the PayPal environment. I might take up your suggestion to use AJAX.

Thanks.





QUOTE(CharlesEF @ Aug 5 2022, 09:43 AM) *

If this is a paypal process script 'process1.txt(php)' then why all the javascript? PHP (server side scripting) can't run javascript, only the browser can (that's why it's called client side scripting). Javascript can call a PHP script but only if you use AJAX.

Do you want the form to submit when the paypal button is clicked?
Or, do you want the form to stay in place when the paypal button is clicked?

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Aug 5 2022, 02:29 PM
Post #4


Programming Fanatic
********

Group: Members
Posts: 1,913
Joined: 27-April 13
From: Edinburg, Texas
Member No.: 19,088



QUOTE(tudsy @ Aug 5 2022, 08:11 AM) *

Hi

Thanks for that.

When the form is submitted and the PayPal button is clicked, I want the Price, Graphic and url information appearing in the PayPal environment. I might take up your suggestion to use AJAX.

Thanks.

If you want the form to submit then all you have to do is make sure that each value you want to send to the PHP script is in some HTML element that will be part of the $_POST array. Price and Graphic might already be in an HTML element. URL might need to be placed in a hidden input so it will be sent to the server in the $_POST array. You might not need the URL in the $_POST array at all, just hard code it in the PHP script. I'm not sure what information is in the URL but do you want users to 'view source' and see it?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
tudsy
post Aug 11 2022, 09:40 AM
Post #5


Advanced Member
****

Group: Members
Posts: 227
Joined: 30-September 14
Member No.: 21,611



Hi

Thanks for that.

When I include the updated process1.php (txt) file, I get a white screen. I dont know whats happening.

Attached are the relevant files:

yourart1.php -> form1.php -> process1.php.





QUOTE(CharlesEF @ Aug 6 2022, 04:59 AM) *

QUOTE(tudsy @ Aug 5 2022, 08:11 AM) *

Hi

Thanks for that.

When the form is submitted and the PayPal button is clicked, I want the Price, Graphic and url information appearing in the PayPal environment. I might take up your suggestion to use AJAX.

Thanks.

If you want the form to submit then all you have to do is make sure that each value you want to send to the PHP script is in some HTML element that will be part of the $_POST array. Price and Graphic might already be in an HTML element. URL might need to be placed in a hidden input so it will be sent to the server in the $_POST array. You might not need the URL in the $_POST array at all, just hard code it in the PHP script. I'm not sure what information is in the URL but do you want users to 'view source' and see it?



Attached File(s)
Attached File  process1.txt ( 5.16k ) Number of downloads: 2
Attached File  form1.txt ( 7.38k ) Number of downloads: 3
Attached File  yourart1.txt ( 16.26k ) Number of downloads: 2
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Aug 13 2022, 02:47 PM
Post #6


Programming Fanatic
********

Group: Members
Posts: 1,913
Joined: 27-April 13
From: Edinburg, Texas
Member No.: 19,088



A 'white screen' normally means there is an error in the PHP section of the page. Do you get any errors? Did you check the PHP error log? I only know what you tell me but you don't tell much at all.

Give me some time to go over your script.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Today, 01:44 AM
Post #7


Programming Fanatic
********

Group: Members
Posts: 1,913
Joined: 27-April 13
From: Edinburg, Texas
Member No.: 19,088



The only thing that I see is a syntax error. This if statement is missing the closing curly brace.
CODE
if ($age > 13){
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 17th August 2022 - 11:46 AM