Forum Moderators: coopster

Message Too Old, No Replies

php tag to start new page

how would I do that

         

youfoundjake

3:10 am on Jul 29, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I have a page that is generated based on a user's selection of a state. They can then choose to use the default letter, or write a custom letter. The state they select will always return 2 people. So I need to output the letter to 2 pages for them to print out. Here is what I have so far...

while ($row = mysql_fetch_array($query)) {echo "<p>",$row['first_name'], " ",$row['last_name'], "<br>", $row['address'], "<br>", $row['city'], ", ", $row['state_dc'], " ", $row['zip'], "<BR>", $row['email_address'], $row['website'], "<P>", "Dear Senator ", $row['last_name'], ",", "<P>","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$letter" ; }

If the letter they put in is less then a whole page, then next senators address is on page one and there for unprintable.
Is there a way to work around that?

lobo235

3:01 pm on Jul 30, 2006 (gmt 0)

10+ Year Member



First of all, your question is rather confusing. I am not exactly sure what you are trying to accomplish. Have you tried using the session to acheive what you are trying to do? Here is how I see it working:

1. User chooses the state
2. The data from the database is then put into an array in the session
3. The user is sent to the first letter.
4. The user performs whatever action they are trying to do on the first page.
5. Once they finish, that senator's info is removed from the session signifying that it's done.
6. The user is sent to the next letter.
7. etc.

Does this make sense?

mcavic

5:43 pm on Jul 30, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The easy answer is no, there's no "page break" tag in either HTML or PHP, because neither one understands what a printer is. There may be another way, but I would work around it by popping up a window with nothing but the first letter, and then popping up a second window with nothing but the second letter. The user can then print each window individually.

Or, you could create a PDF file for each state, and send them that to print. The printed pages would look nicer, but it would take more work for you.

youfoundjake

4:25 pm on Jul 31, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Someone recommanded that I put a table in, after figuring out the character max per page, and just limit that. So it looks like a fixed table with 0 border. That way the 2nd letter starts on the second page.

mcavic

4:49 pm on Jul 31, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That might not work for all of your users. The max characters or lines per page depends on how the browser renders the page, and the printer's capabilities.

rasmusg

5:24 pm on Jul 31, 2006 (gmt 0)

10+ Year Member



Maybe you could use css:

[w3.org...]

youfoundjake

10:03 pm on Jul 31, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Maybe you could use css:
[w3.org...]

I thought of that, but the output is in php so css as far as i know is undoable.

mcavic

10:07 pm on Jul 31, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No, you can use css with php. They are independent of each other.

youfoundjake

11:26 pm on Jul 31, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



oh.. then i will try. this may very well solve this problem across a couple of forms i need to create. give me about a week to figure it out.