0

I have the page VIEW-SALE.PHP on this page I have a submit button form to view the invoice in print format, there is the code:

     <span style='display:inline-block'>
    <form name='print' id='print' action='print-invoice.php' 
target='_blank' method='post'>
        <input type='hidden' name='invoice' value='$invoice'>
        <input class='submit-all' type='submit' 
value='Print the invoice' 
onClick='window.print();return false'></form></span>

The code must just open the page PRINT-INVOICE.PHP and print it but when I click it it show the print dialog but of the current page I am VIEW-SALE.PHP so it does not show the PRINT-INVOICE.PHP

How does it can be done?

2 Answers2

0

doesn't post just post data you may need a header redirect the redirect being php code

header("Location: blabla")

I found this you may find it of help redirect after submit

Community
  • 1
  • 1
nocturnic
  • 11
  • 3
0

the problem is the onClick='window.print();return false'. The window object is the current window containing the form. You should include an javascript event handler in your PRINT-INVOICE.PHP:

... <body onload="window.print()"> ...
ul90
  • 762
  • 3
  • 8