Trouble with a Printer Friendly page

They have: 11 posts

Joined: Aug 2004

I am setting up a "printer friendly" page for my site, and I know nothing of CSS, so I am using the option. This works rather well, however, when I input the data and view the printer friendly page, non of the data that I input is there.

Is there a way to echo the information??

Thanks in advance.

KarenArt's picture

She has: 354 posts

Joined: May 2001

I haven't heard of that. Are you using this in html?
Could you show us your code?

btw: css isn't hard... you'd probably love it once you started playing with it. Wink

gotta finish redesigning my sites so I can show them again.

The purpose of education is... to get more jokes!

They have: 11 posts

Joined: Aug 2004

This is all in html.

The jazz is just something that I made up with my asp script that uses:

call replacetxt("",""," -->").

The script itself from the form just sends the page to a printer friendly version using the following:

KarenArt's picture

She has: 354 posts

Joined: May 2001

Ok... since I don't know ASP at all, I couldn't do a thing for you there. Sad

All I want to ask is, is your page saved as a .html or .htm file or is it a .shtml file.

Your include statetement wouldn't do a thing on a strait html page.
(You may already know this, so don't take it as an insult that I asked)

btw: If this is an asp page you'll need to wait for one of the asp experts here to help you out.

gotta finish redesigning my sites so I can show them again.

The purpose of education is... to get more jokes!

They have: 11 posts

Joined: Aug 2004

Funny thing is: the page format is in html, but due to security purposes, I have the extension set as a php. The actual header reads like so:

<?php
include("protector_normal.php");
?>

Workplace Safety Agreement

a { text-decoration: none }

etc, etc.

The printer friendly version goes to an asp script as I showed you before.

I think after this project, I am taking some time off and going to learn css. I'm sure it would be a lot easier.

KarenArt's picture

She has: 354 posts

Joined: May 2001

Ok I think I get it now... bear with me I'm a little dense. Wink

You have a page that has your pretty formatting with a header, middle(that contains your page content) and a footer. You want a way to make it printer friendly (without using css) by getting rid of your pretty header and footer (or at least change them).

...so the content is the same on the web or a printable page.

Is your content seperated from the layout?
If so you can simply have a "screen" page that has your pretty layout and call your content in through an include or db and another one for printing.

Quote: I think after this project, I am taking some time off and going to learn css. I'm sure it would be a lot easier.

Yep... it definately makes things easier. It's also helpful though to learn to seperate page content from layouts though. Wink

edit to add: I just realized... if your saving this page as a php your include statement should look like this...
<?php include("printlink.asp");?>'
Just like you did with the top include.

gotta finish redesigning my sites so I can show them again.

The purpose of education is... to get more jokes!

They have: 11 posts

Joined: Aug 2004

Well, the way that the page is setup is that it has graphics on the top, bottom, left, and right. The actual printable form section is dead center. That is the information that I am passing on to the printer friendly page. This is being done with the asp link, and it works just fine. However, when they enter the data into the form, their actual input isn't being brought over with the form. This has the customers filling out every form twice if the want a printed version to fax in.

The php section at the top contains the

<?php
include("protector_normal.php");
?>

section, actually is a separate script to keep the files behind a password protected interface.

The code: with the code

KarenArt's picture

She has: 354 posts

Joined: May 2001

All right... here's an idea for you. This would work if you're pages are saved as php and you are using a button to bring up a printable page.

First, copy all the html code on your page that is above your page content (all except the php include at the top).
Save that as a seperate file named header_screen.html
Do the same thing for all the code below your content and save it as footer_screen.html
Now you can make a different header and footer for your printable pages.
Name them header_print.html and footer_print.html.

Now, on your php page (with the page content on it) use this...

<?
include "protector_normal.php";

if ($print == "Print this Page"){
include "header_print.html";
} else {
include "header_screen.html";
}
?>

<form action="<? print "$PHP_SELF" ?>" method="post">
<input type="submit" name="print" value="Print this Page">
</form>

YOUR PAGE CONTENT GOES HERE

<?
if ($print == "Print this Page"){
include "footer_print.html";
} else {
include "footer_screen.html";
}
?>
'

That will bring up the print header and footer if you click on the "Print this Page" button, otherwise the screen header and footer will show.

You don't have to use html pages for your header and footer though. Any type of pages would work.

Hope that helps some!

gotta finish redesigning my sites so I can show them again.

The purpose of education is... to get more jokes!

KarenArt's picture

She has: 354 posts

Joined: May 2001

Well, we were posting at the same time.

Are you saying you're having trouble passing the form values to the printer friendly page?

Sorry I'm confused again... must need more coffee. Roll eyes

gotta finish redesigning my sites so I can show them again.

The purpose of education is... to get more jokes!

They have: 11 posts

Joined: Aug 2004

I've had 4 cups this morning already and still no good.

You hit the nail on the head. When the customer inputs the data and clicks the printer friendly version, I would like to have the new form and the input data. (if possible.)

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

You don't actually need a 'printer friendly' version of your page, or any ASP dedication to generating one. Simply create css for print, you can even apply this across your entire site with little extra effort. As an example here's how you would link/import two external css files, one for screen display one for print (XHTML 1.0):

...

@import url(basestyle.css);

...

The import element is the default, however when the page is printed the browser will (or should!) use the css page specified by the link element. The key here is the "media" attribute, which can be set a number of useful device types (see W3C Candidate Recommendation: http://www.w3.org/TR/CSS21/media.html )

A good way of seeing this in action is the List Apart article: http://www.alistapart.com/articles/goingtoprint/ this shows the point in more detail.

Also you should learn css, but do it properly! Like learning how XHTML works and why it was created, that these days you don't need tables for design, good starting points for this learning are: http://www.alistapart.com http://www.csszengarden.com http://www.zeldman.com obviously http://www.w3c.org is the definitive source for specifications, but the content is a little dry for someone who is learning.

a Padded Cell our articles site!

KarenArt's picture

She has: 354 posts

Joined: May 2001

Ok whew! Now I see where you're going (I think). Wink

What you have is a form on a php page (saved with .php extension) and you want to be able to pass the values collected from that form to a printable page saved with an .asp extension.

What type of page do you normally pass the form values to (if they don't choose the printable page)?

I might be able to help you pass the variables from php to php, but as I said before... I don't know anything about asp.

I'm sorry to have taken you round and round and been no help. Sad
Hopefully someone else can give you some good advice.

gotta finish redesigning my sites so I can show them again.

The purpose of education is... to get more jokes!

They have: 11 posts

Joined: Aug 2004

Well, the page itself actually is html saved with a php extension for the security. When a client fills out the information, they hit submit; the form goes to a php script which then in turn sends it to a mysql database.

They have an option that they can hit printer friendly, and the form goes to an asp script in a printer friendly format. However, after they fill out the form completely, they hit printer friendly version, and they get a fresh form without any of the data they just entered. I am trying to pass this data into the asp, so that way, they can print the whole thing.

I would just leave it alone and let the database pick up the data, but my client wants the option of the customer being able to actually print the form and fax it in. Confused

They have: 11 posts

Joined: Aug 2004

If you happen to know of any great css tutorials, feel free to drop me a line and let me know.

KarenArt's picture

She has: 354 posts

Joined: May 2001

Sounds like you already have a php page coded that collects the form data and displays it on the screen... you just need to have the asp page do the same thing.

Something that might be causing your problem...
in your html page what do you have for "action" in your form?

example:

Are you needing a way to post the form values to 2 seperate pages?

gotta finish redesigning my sites so I can show them again.

The purpose of education is... to get more jokes!

KarenArt's picture

She has: 354 posts

Joined: May 2001

Quote: If you happen to know of any great css tutorials, feel free to drop me a line and let me know.

JeevesBond gave you a great list for really delving into the possibilities of css!
Here's a beginner's tutorial on using css you might find helpful.
http://www.yourhtmlsource.com/stylesheets/introduction.html

I think you'll find that using css would solve most all your problems you're having here. Laughing out loud

gotta finish redesigning my sites so I can show them again.

The purpose of education is... to get more jokes!

KarenArt's picture

She has: 354 posts

Joined: May 2001

I don't know of any way to do that. (of course it's scary all the things I don't know Wink )

With what I know you have 2 options...

Option 1: Send your form info along with an input that shows if the print button was pressed to the php page and either using css or the php code I posted earlier display either a screen version of your page or a print version.

Option 2: Send your form info to the php page and have the print button on that page. If they hit the print button send the form info to the asp page using hidden inputs.

Sorry my knowledge runs out there. Hope this can be of some help to you!

Best of luck with this job!
Let us know how it all works out. Laughing out loud

gotta finish redesigning my sites so I can show them again.

The purpose of education is... to get more jokes!

KarenArt's picture

She has: 354 posts

Joined: May 2001

Good luck!
... and have fun with it! Laughing out loud

They have: 11 posts

Joined: Aug 2004

AHHHHHHHHh, you may have it!

That is the form action to send the data to the php form. I do not have anything sending it to an asp.

Here's a goofy question: Can you have two form actions on a form???

They have: 11 posts

Joined: Aug 2004

Thank you very much for your input. You really have been a great help.

I now have a couple of things that I can really research.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.