I could use a little help here. I have goodled with not much luck. I
have been at this for a bit and would appreciate suggestions.
I have a form (A.php) that collects a lot of data. When I post it, I
gather the data (in A_process.php) and insert/update into a database
using php and mysql. I then redirect back to the original page (A.php)
using a "header" command. This all works fine.
The customer would like me to put in "print" button that would bring up
a printable version in another window (B.php). The problem is that I
want to do this while keeping all the data displayed on the current window.
I have tried creating a json string so that all I would need is
json_decode on the php side to convert it into an array and build the
page. I then did a window.open(). The result was that the string was
too long for the URI for the server. (It would most likely also get the
same problem using AJAX since the parameters are in the URI). Using AJAX
to receive a lot of data from the server is easy. It seems to be very
hard going in the other direction. So, I am looking for suggestions.
I am considering doing this entirely in php by changing the print button
from type "button" to type "submit", testing in the target (processing,
A_process.php) file that it was the print button that sent it, creating
a session variable , and then opening a new window (B.php). In that
window I could read the session variable and destroy it. (I can't just
target to the new window (B.php), because I need to keep the processing
page for database submission and returning to an empty generating page
in the original window (A.php).)
I guess that this method might work, but there must be a better,
simpler, and more straightforward solution somewhere.
have been at this for a bit and would appreciate suggestions.
I have a form (A.php) that collects a lot of data. When I post it, I
gather the data (in A_process.php) and insert/update into a database
using php and mysql. I then redirect back to the original page (A.php)
using a "header" command. This all works fine.
The customer would like me to put in "print" button that would bring up
a printable version in another window (B.php). The problem is that I
want to do this while keeping all the data displayed on the current window.
I have tried creating a json string so that all I would need is
json_decode on the php side to convert it into an array and build the
page. I then did a window.open(). The result was that the string was
too long for the URI for the server. (It would most likely also get the
same problem using AJAX since the parameters are in the URI). Using AJAX
to receive a lot of data from the server is easy. It seems to be very
hard going in the other direction. So, I am looking for suggestions.
I am considering doing this entirely in php by changing the print button
from type "button" to type "submit", testing in the target (processing,
A_process.php) file that it was the print button that sent it, creating
a session variable , and then opening a new window (B.php). In that
window I could read the session variable and destroy it. (I can't just
target to the new window (B.php), because I need to keep the processing
page for database submission and returning to an empty generating page
in the original window (A.php).)
I guess that this method might work, but there must be a better,
simpler, and more straightforward solution somewhere.
Comment