Click to See Complete Forum and Search --> : [RESOLVED] Printing Issues


joe69
05-11-2009, 09:10 PM
I have a question about printing a window in PHP. I had posted before and it was working, but something happened and its not working now. Here is the line of code that I have. can someone tell me whats wrong with this. To set this up, I have a page that has a form, the user fills out the form and clicks a button to "print" the form. I have it redirecting to a new page that just displays the form data and at the end of the code, it sends an email to me telling me who filled out the form. then it is supposed to do the window.print() and open the print dialog box, but that doesnt happen. Any help here would be greatly appreiated

echo "<script language='javascript'>window.print();</script>";


Joe

johanafm
05-15-2009, 01:13 PM
Apart from having a language attribute and no type attribute, it looks fine.

<script type="text/javascript">...</script>


Are you certain that code gets sent to the page? Have you looked at the page in FF and taken a look in its error console (or used other equivalent means such as safari's error console).

joe69
05-15-2009, 01:52 PM
I am soooooooooo new to this I am not familiar with whatever FF is or safaris error console.
sorry

johanafm
05-16-2009, 12:43 AM
FF is Firefox and it comes with a message window showing you everything that's wrong in a page (according to FF. You should still run your (x)html code through validator.w3.org or similar). FF is definitely my prefered browser for development. Apart from the built in error console there's an excellent plugin called Firebug.
Safari is another browser and ships with similar tools.
I don't really like the stuff that ships with Internet Explorer 8 but it is better than IE7.

Weedpacket
05-16-2009, 01:28 AM
A tetanus injection is better than IE7 :)

As well as using the error console in your browser, use its "view source" option as well, just to confirm that the <script> tag is actually in the page.

joe69
05-16-2009, 10:16 PM
ok thanks for the info. I will study a little mroe on this and possibly post again if I can't get it.
I will mark this one resolved for now. Thanks