From: drieux <[EMAIL PROTECTED]>
> On Friday, April 12, 2002, at 07:15 , Kris G Findlay wrote:
> 
> > ok exact problem !!
> >
> > Example data inputed via form :
> > 'here is a quote  "this Quote".'     # which is passes to variable
> > $document
> >
> > if i use hidden fields in a html form to store these variables while
> > the page displays a preview eg  print "<input type=\"hidden\"
> > name=\"hiddenField\" value=\"$document\ ">"
> >
> > the html page returned displays corectly and all data is in source
> > eg  <input type="hidden" name="hiddenField" value="here is a quote 
> > "this Quote".">" but when form is submited to cgi the data after the
> > extra quote mark is missing
> 
> [..]
> 
> $hiddenField = param('hiddenField');
> 
> $hiddenField =~ s/\"/\\\"/g; # \\ - insert \ and \" guard my "
> 
> which I think would work ....

No it will not.

The " should be replaced by &quot; or &#34;.

This is the safest method:

        use HTML::Entities;
        $hiddenField = encode_entities(param('hiddenField'));

        $html = qq{<input type=hidden name=something 
value="$hiddenfield">};

Jenda

=========== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==========
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
                                        --- me

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to