PayPal checkout and PHP |
PayPal checkout and PHP |
tudsy |
Aug 4 2022, 03:48 AM
Post
#1
|
Advanced Member Group: Members Posts: 248 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. Attached File(s) process1.txt ( 5.64k ) Number of downloads: 667 |
CharlesEF |
Aug 4 2022, 07:13 PM
Post
#2
|
Programming Fanatic Group: Members Posts: 1,984 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? |
tudsy |
Aug 5 2022, 08:11 AM
Post
#3
|
Advanced Member Group: Members Posts: 248 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. 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? |
CharlesEF |
Aug 5 2022, 02:29 PM
Post
#4
|
Programming Fanatic Group: Members Posts: 1,984 Joined: 27-April 13 From: Edinburg, Texas Member No.: 19,088 |
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? |
tudsy |
Aug 11 2022, 09:40 AM
Post
#5
|
Advanced Member Group: Members Posts: 248 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. 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) process1.txt ( 5.16k ) Number of downloads: 592 form1.txt ( 7.38k ) Number of downloads: 568 yourart1.txt ( 16.26k ) Number of downloads: 642 |
CharlesEF |
Aug 13 2022, 02:47 PM
Post
#6
|
Programming Fanatic Group: Members Posts: 1,984 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. |
CharlesEF |
Aug 17 2022, 01:44 AM
Post
#7
|
Programming Fanatic Group: Members Posts: 1,984 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){ |
tudsy |
Aug 18 2022, 03:55 AM
Post
#8
|
Advanced Member Group: Members Posts: 248 Joined: 30-September 14 Member No.: 21,611 |
Hi
Thanks for that. There is no error file produced. Sorry for the lack of information. 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. |
tudsy |
Aug 18 2022, 03:56 AM
Post
#9
|
Advanced Member Group: Members Posts: 248 Joined: 30-September 14 Member No.: 21,611 |
Hi
Thanks for that. There is no error file produced. Sorry for the lack of information. 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. |
CharlesEF |
Aug 18 2022, 02:42 PM
Post
#10
|
Programming Fanatic Group: Members Posts: 1,984 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?
|
tudsy |
Aug 18 2022, 02:52 PM
Post
#11
|
Advanced Member Group: Members Posts: 248 Joined: 30-September 14 Member No.: 21,611 |
|
CharlesEF |
Aug 18 2022, 08:46 PM
Post
#12
|
Programming Fanatic Group: Members Posts: 1,984 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. |
tudsy |
Sep 7 2022, 08:10 AM
Post
#13
|
Advanced Member Group: Members Posts: 248 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. 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) process1.txt ( 5.42k ) Number of downloads: 401 |
CharlesEF |
Sep 7 2022, 02:39 PM
Post
#14
|
Programming Fanatic Group: Members Posts: 1,984 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.
|
CharlesEF |
Sep 7 2022, 04:27 PM
Post
#15
|
Programming Fanatic Group: Members Posts: 1,984 Joined: 27-April 13 From: Edinburg, Texas Member No.: 19,088 |
Did any of the error reporting methods work for you?
|
tudsy |
Sep 12 2022, 09:29 AM
Post
#16
|
Advanced Member Group: Members Posts: 248 Joined: 30-September 14 Member No.: 21,611 |
|
tudsy |
Sep 12 2022, 12:13 PM
Post
#17
|
Advanced Member Group: Members Posts: 248 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. Hi Sorry for the late reply. Yes the error reporting works. Thanks. Did any of the error reporting methods work for you? Attached File(s) process1.txt ( 5.29k ) Number of downloads: 444 |
CharlesEF |
Sep 12 2022, 04:39 PM
Post
#18
|
Programming Fanatic Group: Members Posts: 1,984 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 |
tudsy |
Oct 5 2022, 09:22 AM
Post
#19
|
Advanced Member Group: Members Posts: 248 Joined: 30-September 14 Member No.: 21,611 |
Hi
Just a quick one. By any chance you had a look at my program? Thanks. 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. |
CharlesEF |
Oct 6 2022, 03:16 PM
Post
#20
|
Programming Fanatic Group: Members Posts: 1,984 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.
|
Lo-Fi Version | Time is now: 26th September 2024 - 09:44 AM |