in reply to CSS for printing and tell-a-friend scripts

My first bit of advice so you kind sir or madam is to not lead off a question like that. It tends to grate on folks and may result in questions going unanswered. IOW: don't grovel! :-)

First I'd recommend you go on over to the Tutorials page and learn how to research for answers on your own.

The first question. BIG HINT: what you are looking for is how to read the CGI headers and find what page has referred the browser to your script. IIRC the variable is HTTP_REFERRER (fat fingers!) HTTP_REFERER and you should be able to get it off the %ENV hash.

Here is an html you can use to test what I am talking about:

<!-- HTML to reference our script --> <a href="/cgi-bin/test.pl">Click Me</a>
and a Perl/CGI script with very minimal functionality:
#!/usr/bin/perl printf "Content-type: text/html\n\n\n"; printf "%s -- %s<br>\n",$_,$ENV{$_} foreach sort keys %ENV;

CAVEAT: Don't leave that code on your production environment as there is some serious information leaking going on there. It is there for demonstration purposes only.

Once you figure out where the user is coming from page wize the rest is using Mail::Send or MIME::Lite or other CPAN module to to send your mail after you have processed it with CGI and some glue code.

The second question. Other monks here have done a bang up job answering that one. The answer lies in the use of CSS and the media attribute (directive?).

With that information in your hands go forth, code and conquor!

Replies are listed 'Best First'.
Re^2: CSS for printing and tell-a-friend scripts
by BUU (Prior) on Dec 07, 2004 at 22:36 UTC
    The first question. BIG HINT: what you are looking for is how to read the CGI headers and find what page has referred the browser to your script. IIRC the variable is HTTP_REFERRER and you should be able to get it off the %ENV hash.
    I believe if you'll look at the spec, you'll find that it's actually HTTP_REFERER.