Solved

printing in php!!!!!

Posted on 2002-06-20
11
215 Views
Last Modified: 2006-11-17
hai all,

I have a php(+html codes) thru which I try to display my queries.
In that if I add print button(which links to javascript window.print function),Iam able to print the table with no format.If I wanted to print only 30 rows in one page & remaining in successive pages(/page= 30 rows),how am I implement this feature.can anyone help resolve this issue.

Thanking you,
manju
0
Comment
Question by:manju70
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 4

Expert Comment

by:lokeshv
ID: 7097809
Display 30 rows per page..and print it :o)

Lk
0
 

Author Comment

by:manju70
ID: 7098250
yes
0
 
LVL 8

Accepted Solution

by:
us111 earned 18 total points
ID: 7098317
- create a button
- add a javascript action that calls and opens a new php page
- this page display 30 rows
- open the print windows

I have no other solutions
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 17

Expert Comment

by:psimation
ID: 7098593
manju70
us111 is correct, maybe to help to make it more clear, use your existing code , and then simply limit your output to 30 lines . This can be done by adding a "...limit 30" to the end of your SQL query, or to have a while loop that only creates 30 lines at a time, and then have a "next" link on the page to execute and display the rest of the lines , 30 ata a time.
 
0
 
LVL 8

Expert Comment

by:us111
ID: 7098598
but if your page has more than 30 records, it would be impossible to print 2 friendly pages
0
 
LVL 5

Expert Comment

by:Hamlet081299
ID: 7105856
I think there is actually an HTML code which will force a page break in printing (I forget what it is though), but there may be better ways of doing this.

You could try rendering the output as a PDF, and then printing.

You could also have the print button link to another page, which automatically loads 30 records at a time and prints each one, then automatically jumps to the next 30, etc.
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 7106815
There are CSS Style print codes. These are NOT HTML codes.

The full definition is at ...

http://www.w3.org/TR/1998/REC-CSS2-19980512/page.html

but your broweser (or rather your customer's browser) will need to support this!!!

Without doubt, the best way is to send the client a pre-rendered document (rtf/pdf/DOC via COM!!!/etc).

Having a seperate window with the table size being set by the end-user is a good idea. Simpler to implement than PDF (maybe), but no automation as the print command returns true immediately, even if the printing is still working. So you can't generate 10 pages, calling the print event between each generation as you will probably get 9 headers and then 1 full page. It'll be a mess!

Richard.
0
 

Author Comment

by:manju70
ID: 7109751
hai all,

Thank you for your responses.
I got my requirements as per us111 & psimation comments.
So I wanted to distribute my points among these 2 experts.I have asked the commnunity support to distribute it accordingly.

a big thanks for all who contributed.
Manju

0
 
LVL 8

Expert Comment

by:us111
ID: 7109915
thx
0
 
LVL 5

Expert Comment

by:Netminder
ID: 7114290
Per request (http://www.experts-exchange.com/commspt/Q_20316277.html), points reduced to 18 to facilitate split.

manju70,

You should now leave a 17-point question in this topic area for one of the two Experts. Then come back to this question and accept the comment of the other, and leave a link here to the "points for" question.

In the "points for" question, be sure to leave a link back to this question to complete the circle.

Netminder
CS Moderator
0
 

Author Comment

by:manju70
ID: 7115459
hai psimation,

As I wanted to distribute my marks between u & us111 , I have created another question(as per community support instructions)
the link is
http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=php&qid=20317170

after u answer, the points will evventually deposited in ur account.

Thank u,
manju
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question