I have used get method in my form and retrieving the content of text box in
$value using:
$buffer = $ENV{'QUERY_STRING'};
($name,$value)=split(/=/,$buffer);
Now I want to preserve my text box:
I had tried:
print "<form action='/cgi-bin/abcd.cgiv' method='get'>";
print "<input name='search' size =30 value='$value'>";
print "<\/form>";
Now wen i write therock'ravi
the text box only shows therock and it removes everything after ' (including ')..
any solution...
thanx
Scott
2
Hi.
Not sure. Is that a single quote in your input?
Perhaps you need to use "addslashes" on $value to escape that.
Can you please elaborate it coz I've tried everything...
---------- Post updated at 06:58 AM ---------- Previous update was at 06:45 AM ----------
I think we use addslashes in php...
there is no such thing in perl....
pls help me out..
thanx
Scott
4
Hi.
Sorry, I thought it was PHP. I do need new glasses
My meaning was to escape the single quote:
i.e.
$value =~ s/'/\\'/g;
Its printing '
But now its not working for "
I even tried:
$value =~ s/"/\\"/g;
But not working...
---------- Post updated at 07:19 AM ---------- Previous update was at 07:17 AM ----------
Sorry..
Its displaying \ in the place of '
after trying
$value =~ s/'/\\'/g
;
Scott
6
Try the HTML code for '
value =~ s/'/& #39;/g
(without the space between & and #)
Its working...
thanx a lot scottn...
But now it created another problem:
when I type therock"
I get therock" in my text box..
Still my text box is not totally preserved...
pls help me out..
thanx
Scott
8
Hi.
So the single quote was confusing value=... and now maybe the double quote is confusing print ".....
So you need to escape that.
There should be a perl function to deal with this (it is the language of choice for this kind of thing).
Perhaps something like
use HTML::Entities;
...
$value = encode_entities( $value );