Forum Moderators: coopster
In an application I'm working on, I've got a bunch of form pages which ends in a "Thank You" page which is pretty typical.
When this "Thank You" page is included after all previous form pages are filled out, it (the Thank you page) then includes two other "modules"
1. One that shows a progress bar, and...
2. One that transfers a whole bunch of vars into a database and then sends 2 emails.
The problem I'm having is that when the application calls the Thank you page, it doesn't show up until AFTER the db is populated AND the emails are sent. This - to me - is really strange since the module handling the DB population and emails is WITHIN the thank you page and it is being included AFTER the progress bar module.
Obviously, the workflow I want is that the Thank You page would show up, and the progress bar would begin to file WHILE the DB and email functions are working.
Has anyone had this kind of problem before? And, if so, what am I missing?
Neophyte
>>Is the Thank You page printed to the screen before proceeding to the rest of the transactions<<
The Thank you page SHOULD be printing to the screen before proceeding to the transactions, but it's not - it's the other way around: transactions are happening and after they're through, THEN the thank you page with the "transaction" progress bar shows up.
The way I've got it set up right now, it's like this:
Form page 1
- all kinds of form elements inside
Form page 2
- all kinds of form elements inside
Form page 3
- all kinds of form elements inside
Thank You page
- First call to include the progress bar
- Second call to include routines which dump info into the DB and send emails
So... to my (simple) mind, the program flow should be correct, but what's happening is that when the user hits the submit button on page three, DB and Email action happens FIRST and then when they're done the Thank you page shows up. Strange, isn't it? I don't understand what's going on.
>>Are you using any kind of buffer?<<
No, I'm not using any kind of buffer - I didn't think it would be necessary since the transactions I'm doing are suppose to be happening from inside the page I want displayed.
Any ideas?
Neophyte
Thanks for the suggestion; while I do understand the logic of your suggestion, unfortunately it didn't solve my problem; I really don't know what would be causing this strange behaviour. I'll re-pick through my code and see if I can trouble-it out.
In the mean time, if anyone else recognizes this problem and has a solution, I'm all ears.
Neophyte
; Output buffering allows you to send header lines (including cookies) even
; after you send body content, at the price of slowing PHP's output layer a
; bit. You can enable output buffering during runtime by calling the output
; buffering functions. You can also enable output buffering for all files by
; setting this directive to On. If you wish to limit the size of the buffer
; to a certain size - you can use a maximum number of bytes instead of 'On', as
; a value for this directive (e.g., output_buffering=4096).
output_buffering = 4096
This means if your "Thank you" page output is not more then 4096 bytes, and script is still working on db/emails it would wait for script finish.
Try [ua2.php.net...] just before db/email processing.