Reputation: 1971
I am new to CGI, my code output:
Hello, "<h1>Tom Cat</h1>"!
Seems the escapeHTML()
doesn't work.
I develope my cgi code with XAMPP 1.7.2 on winxp. How can I fix it. Do I need download & install extra CGI Plugin for the current XAMPP? Appreciated for your help.
#!C:/Perl/bin/perl.exe -w
use strict;
use CGI;
my $q = CGI->new();
print $q->header();
my $value = $q->param("myvar");
print $q->header();
print "<html><body>";
#print qq{Hello, "$value"!\n};
print qq{Hello, "}, CGI::escapeHTML($value), qq{"!\n};
print "</body></html>";
Upvotes: 0
Views: 3095
Reputation: 3364
What are you expecting it to do? escapeHTML takes your string and changes it so the what will display is what is in the string - it turns it into something else that your browser then turns back to the original test.
It would appear that your parameter "myvar" contains the <h1> tags, which escapeHTML turns into <h1>, so that your browser can restore the original text.
If you want it not to do this but to interpret the tags, you need not to escape it.
Upvotes: 5