The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

2 Pages V  1 2 >  
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: 246
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: 354
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,981
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: 246
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,981
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: 246
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: 327
Attached File  form1.txt ( 7.38k ) Number of downloads: 308
Attached File  yourart1.txt ( 16.26k ) Number of downloads: 372
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,981
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 Aug 17 2022, 01:44 AM
Post #7


Programming Fanatic
********

Group: Members
Posts: 1,981
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
tudsy
post Aug 18 2022, 03:55 AM
Post #8


Advanced Member
****

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



Hi

Thanks for that. There is no error file produced. Sorry for the lack of information.



QUOTE(CharlesEF @ Aug 14 2022, 05:17 AM) *

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
tudsy
post Aug 18 2022, 03:56 AM
Post #9


Advanced Member
****

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



Hi

Thanks for that. There is no error file produced. Sorry for the lack of information.



QUOTE(CharlesEF @ Aug 14 2022, 05:17 AM) *

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 Aug 18 2022, 02:42 PM
Post #10


Programming Fanatic
********

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



What version of PHP do you use? When I upgraded to PHP 7.14 I copied 'php.ini-development' to php.ini and all the errors appear on screen. Since you say there is no error log do you see PHP errors on screen?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
tudsy
post Aug 18 2022, 02:52 PM
Post #11


Advanced Member
****

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






php 8.1







QUOTE(CharlesEF @ Aug 19 2022, 05:12 AM) *

What version of PHP do you use? When I upgraded to PHP 7.14 I copied 'php.ini-development' to php.ini and all the errors appear on screen. Since you say there is no error log do you see PHP errors on screen?

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Aug 18 2022, 08:46 PM
Post #12


Programming Fanatic
********

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



Insert this line at the top of your PHP script:
CODE
ini_set('display_errors', 1);
Do you see errors on screen now? If you want to change PHP.ini to make it permanent then set
CODE
display_errors = On
Or, in v8.1 just copy 'php.ini-development' to 'php.ini'. This should only be done on a development PC.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
tudsy
post Sep 7 2022, 08:10 AM
Post #13


Advanced Member
****

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



Hi

I have added 3 hidden input tags in process1.php but I am not sure where to put these in process1.php. Do you put these 3 input tags in the php area or outside the php area of the script process1.php?

Thanks.







QUOTE(CharlesEF @ Aug 19 2022, 11:16 AM) *

Insert this line at the top of your PHP script:
CODE
ini_set('display_errors', 1);
Do you see errors on screen now? If you want to change PHP.ini to make it permanent then set
CODE
display_errors = On
Or, in v8.1 just copy 'php.ini-development' to 'php.ini'. This should only be done on a development PC.



Attached File(s)
Attached File  process1.txt ( 5.42k ) Number of downloads: 169
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Sep 7 2022, 02:39 PM
Post #14


Programming Fanatic
********

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



Hidden inputs are HTML elements. They go inside the form. When submitted they are passed in the POST array, if you have the name attribute set.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Sep 7 2022, 04:27 PM
Post #15


Programming Fanatic
********

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



Did any of the error reporting methods work for you?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
tudsy
post Sep 12 2022, 09:29 AM
Post #16


Advanced Member
****

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



Hi

Sorry for the late reply.

Yes the error reporting works.

Thanks.



QUOTE(CharlesEF @ Sep 8 2022, 06:57 AM) *

Did any of the error reporting methods work for you?

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
tudsy
post Sep 12 2022, 12:13 PM
Post #17


Advanced Member
****

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



Hi

I found this piece of code on the web:

<?php

function shutdown(){
var_dump(error_get_last());
}

register_shutdown_function('shutdown');

?>

I put this code on top of process1.php script and the output was the word NULL.

Need help!
Thanks.






QUOTE(tudsy @ Sep 12 2022, 11:59 PM) *

Hi

Sorry for the late reply.

Yes the error reporting works.

Thanks.



QUOTE(CharlesEF @ Sep 8 2022, 06:57 AM) *

Did any of the error reporting methods work for you?




Attached File(s)
Attached File  process1.txt ( 5.29k ) Number of downloads: 179
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Sep 12 2022, 04:39 PM
Post #18


Programming Fanatic
********

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



If error reporting is working now then why do you need this? According to the docs, the shutdown process is called after script execution finishes or exit() is called. When error_get_last is called it returns NULL if there is no error to report. I'll look over your file later, when I have more time. Also, error_get_last returns an array when there is an error. So you should test for an array and use print_r.

This post has been edited by CharlesEF: Sep 12 2022, 04:42 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
tudsy
post Oct 5 2022, 09:22 AM
Post #19


Advanced Member
****

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



Hi

Just a quick one. By any chance you had a look at my program?

Thanks.







QUOTE(CharlesEF @ Sep 13 2022, 07:09 AM) *

If error reporting is working now then why do you need this? According to the docs, the shutdown process is called after script execution finishes or exit() is called. When error_get_last is called it returns NULL if there is no error to report. I'll look over your file later, when I have more time. Also, error_get_last returns an array when there is an error. So you should test for an array and use print_r.

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Oct 6 2022, 03:16 PM
Post #20


Programming Fanatic
********

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



Exactly what problem are you having? I thought it was about the shutdown part. Describe the problem, what you expect from your code and what the code actually does.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

2 Pages V  1 2 >
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: 19th March 2024 - 06:27 AM