in reply to Problems printing to browser

The problem is probably that your script dies due to the typo here when you call a function on an undefined value

print my $cgi->escapeHTML( $tags); # should be $query not $cgi print $query->escapeHTML( $tags );

Your CGI object is called $query not $cgi. Checking the error logs would have revealed this and avoided your frustration.... The script compiles OK because this is a runtime error.

If this fails then check what the script is actually getting from your form:

use CGI; my $query = CGI->new; print $query->header; %form = $query->Vars; use Data::Dumper; print $query->escapeHTML(Dumper(\%form));

If that is not usefull see the CGI Help Guide I wrote.

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Replies are listed 'Best First'.
Re: Re: Problems printing to browser
by sulfericacid (Deacon) on Nov 29, 2002 at 11:18 UTC
    Ok, you were right, that is what the problem was. I didn't know print $cgi was deaing with print $query, never would have guessed that.

    I have another problem. The script runs fine. In the browser it prints as per you'd expect, but in the email it prints something like:

    <meta name="author" content="Aaron"><br> <meta name="keywords" content="Apples"><br>
    It literally prints <br> in the email. Do you know of a way I can make it print to broswer one tag per line but somehow only print the tags in the email?

    Thanks so much!

    sulfericacid

      Sure just use a s/// regex to remove the <br> tags.

      my $text =<<TEXT; foo<br> bar<br> baz<br> TEXT print $text; # to browser $text =~ s/<br>//g; print $text; # to email

      cheers

      tachyon

      s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print