This is better, replace the quotes with nothing and then build your input
tag.

#!/usr/bin/perl

use CGI;
use strict;

my $cgi = new CGI; print $cgi->header;
my $query = CGI::new();

my $frage_text= "\"Hello World\"";

$frage_text =~ s/"//g;

print "<form name=\"test\" action=\"http://www.somewhere.com\";>\n";
print "   <input type=\"text\" name=\"frage_text\" size=\"100\"
value=\"$frage_text\" />\n";
print "</form>\n";

I hope this helps 
Regards Ash.



-----Original Message-----
From: Jan Eden [mailto:[EMAIL PROTECTED] 
Sent: 11 May 2004 04:21 PM
To: David Dorward; Perl Lists
Subject: Re: Escaping quotes in variable content

Hi David,

David Dorward wrote on 11.05.2004:

>On 11 May 2004, at 14:58, Jan Eden wrote:
>>how can I escape quotes within a variable's content? I use the
>>following directive to fill an HTML form: <input type="text"
>>name="frage_text" size="100" value="$frage_text" /> Unfortunately,
>>if $frage_text contains a double quote, the browser will stop
>>displaying the string at that point. I tried to escape the quotes
>>in a Perl way $frage_text =~ s/"/\\"/g;
>
>In HTML characters are 'escaped' by converting them to entities.
>&entityName; Quote marks are &quot;
>
>You probably want to use escapeHTML() from the CGI module.

Doh. I have been working on the script for several hours now and forgot the
most simple things about HTML.

Thanks,

Jan
-- 
Common sense is what tells you that the world is flat.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to