leela Posted December 26, 2008 Share Posted December 26, 2008 Hai, i have invoice form..where i am saving into databse.but i need to save at the same time i save the form..is there any option for doing so.. Thanku ALL, Leela Quote Link to comment https://forums.phpfreaks.com/topic/138441-can-i-save-and-print-the-form-in-php-at-the-same-time/ Share on other sites More sharing options...
leela Posted December 26, 2008 Author Share Posted December 26, 2008 Hai, i have invoice form..where i am saving into database.but i need to print at the same time i save the form..is there any option for doing so.. Thanku ALL, Leela Quote Link to comment https://forums.phpfreaks.com/topic/138441-can-i-save-and-print-the-form-in-php-at-the-same-time/#findComment-723852 Share on other sites More sharing options...
crazytonyi Posted December 26, 2008 Share Posted December 26, 2008 I'm no expert, but I think the way to do this would be to... have the script that handles saving the form (whatever you have in action="" in the form tag) save the data to the database and also echo the html code that you want the invoice to look like to with the data filled in and with a javascript function in the head that sends the command to the user's printer to print. SO! you have a couple of choice: 1. You can have the script that handles inserting the data query the database for that same data (which is probably bad practice), or simply use the same $_POST variables that you are adding to the database to echo into the printable page. 2. You could make the page "printer-ready" meaning it will print what the user sees on the screen which will be coded to look better on paper OR you can use @media print in your CSS and have it look good on the screen and on the page (changing the margins, getting rid any nav divs, change the font, etc)... There are plenty of sites that go over the different way's of going about the CSS option. And as far as the page auto printing on load, you need to put this javascript somewhere in there: onLoad="window.print()" Quote Link to comment https://forums.phpfreaks.com/topic/138441-can-i-save-and-print-the-form-in-php-at-the-same-time/#findComment-724094 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.