Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have a problem with textfields, just textfields with quotes, see if I put quotes in there like

People "Have" many "problems" (it prints in textfield)
People many

But if I were to use " it shows up! but lets say I get all this information from my form and I need to check it all for quotes and make them " Have any ideas.

Replies are listed 'Best First'.
Re: Forms Textfields
by BUU (Prior) on Oct 09, 2002 at 03:02 UTC
    use html::entities to encode the quotes, then decode them to reverse it..
Re: Forms Textfields
by LTjake (Prior) on Oct 09, 2002 at 11:14 UTC
    If you're using CGI.pm, it has a function called escapeHTML. Here's an example:
    use strict; use CGI; my $q = new CGI; my $content = qq(People "Have" many "problems"); print $q->header; print $q->escapeHTML($content);
    produces:
    People "Have" many "problems"
      $sth = $dbh->prepare("$ins") or die $dbh->errstr; $sth->execute(map(scalar escapeHTML(param($_)), qw(cat itemid des lon +gdes size o1n o1o o2n o2o o3n o3o c1n c1v c2n c2v c3n c3v)),$price,$s +mall,$large) or die $dbh->errstr;
      Works great, im problay going to make my own sub that will do this.