View Full Version : Showing transitions of pages users between pages

02-22-2008, 01:50 AM
hi ,

i have a payment processing system
Page 1 contains form for CC detials
Page 2 or script is called when user submits form from page 1. it performs transaction send user to page3

Now i have changed the server and thats is taking more to process transaction about 17-18 seconds.

Now what i want is as tranaction is taking place i show on the small screen at the center of page e.g

processing transaction

bank contacted ...

payment approved

redirecting to page ....

so that customer knows what is happeing

but i am not sure on which page i code this

Even when i put echo statement on page 2 where processing is taking place it is not showing anything . when i submit form , it styas on page 1 for 16-17 seconds and then on page 3

I am not seeing any ouput (echo) from page 2

whay is this so

02-22-2008, 04:11 AM
The delay must be in the sending of data to server and reading data
on page 2 ... I'm assuming you are using HTTPS (secure server) on the
pages because you're gathering CC information?

So, the delay happens before page 2 is displayed ... it then displays so
fast and redirects to page 3, you don't see it.

I don't really have an answer to this because you don't really have
control over how long it is taking your server to process the variables.

02-22-2008, 04:32 AM
on page 2 after getting the responase from bank , i am updating databse for approved transcationand all that and then i redirect to page 3.

Is this not possible that after reaching certains points i can display the text in the box
which can indicate that system has reached at this point

02-23-2008, 01:34 AM
A way (though there may be others) is to use AJAX, and ob_flush (http://us.php.net/ob_flush). With AJAX, people normally wait for the page to totally done processing (response code 4 I think) but if you start looking at the response before it is complete (3 i think) then you can display information about what is occurring on the server side while its loading.

A crappier way of doing this would be to load a page that makes it look likes its doing step 1, step 2, etc. but really has already run the script. (If you want to do this, but don't want to wait for the script to finish first, use register_shutdown_function (http://us3.php.net/manual/en/function.register-shutdown-function.php).) Though never the best idea, this can come in handy for cases when (for whatever reason) your users feel like they need to see something happening.

(For instance, I have an AJAX save button on one of my web applications. My users kept clicking them over and over again because they thought that it was saying "Saved" too quickly to have actually saved, so I added a delay to it. Same type of idea here. Again, not the ideal way to go.)