I’m not sure I can help, but I cannot even see you code. Servers typically will never send the contents of PHP files, This is a good thing and appears to be happening here. Try copying it into a .txt file or just use pastebin.com. Post the new link here and I’ll see if I can offer any advice.
Hello bcworkz,
thank you for following up i pasted the code on pastebin.com here is the link http://pastebin.com/GW4MuigY
I don’t know what a lot of the methods used do, so if any of them initiate a redirect, I would not know it. Still, it appears there is no redirect upon successful payment. AFAICT, the successful payment portion of the code starts at line 1128 of the pastebin code and runs until line 1136. Most of the remaining code relates to various failure conditions.
Within that block I would expect to see a redirect code such as there is at line 1188. The problem is though at line 1130 there is an echo statement which will cause any subsequent PHP redirects to fail. PHP redirects must be called before any output is sent because the redirect is caused by sending a “Location:” header. No headers can be sent after output to the browser. If you want a redirect after output is sent, you must use javascript, it cannot be done with PHP.
Well i couldn’t figure it out how to do it inside the same file, but i changed the redirection to My Account page and i’m trying to add the get_response code inside that page so it displays a message once they respond, however i tried to do so which supposed to be easier but still not working… here is the my account code http://pastebin.com/4rAkm9A9
It should ring a bell if you take a look at it i think. thank you.
I’ve never tried passing data through a redirect, so I’m speculating here. I believe that after a redirect, the values in $_POST
are gone. $_POST
values should only be valid for the page specified as the action attribute of the form.
I’m not sure you can pass POST data through a redirect, you should be able to pass data through $_GET
though. You would need to append URL parameters to the redirect URL. A truncated example, just add in the rest of the data:
wp_redirect( $get_checkout_url.'?txtMerchNum='.$_POST['txtMerchNum'].'&txtIndex='.$_POST['txtIndex']);
Im sorry i didn’t quite get you, im not advanced with php could you edit it the way you think its good?
I’ll try. When the form is submitted via POST to the page that interfaces with the payment gateway, as you know, the form data is all available in $_POST
. After the payment is processed and you redirect to My Account, it is seen as a new GET page request. Whatever data that was in $_POST
dies with the interface page.
Thus you need to take measures on the interface page to pass data you need on My Account from $_POST
while still on the interface page. That is where the suggested (my previous post) redirect line comes in. That line is just an example though, it is incomplete, you need to add parameters for all data needed on My Account.
When data is passed as suggested, it can be accessed with $_GET
in the same way that $_POST
was used. For example, the ‘txtIndex’ value is contained in $_GET['txtIndex']
.
I hope this makes more sense. If there is any part you do not still understand, explain how you are confused and I will try to explain further.