CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Ampersand in Form Submissions

 



gregarios
stranger

Apr 7, 2002, 12:44 AM

Post #1 of 5 (587 views)
Ampersand in Form Submissions Can't Post

I have a standard form script. How can I have it behave correctly when someone types in text that has ampersand and equals characters in it? Currently, the recipient, and other form fields are split by & then split by = to get the data; is there another way?

Greg J Piper
[url=http://www.macpicks.com]MacPiCkS



kidd
User

Apr 7, 2002, 10:58 AM

Post #2 of 5 (586 views)
Re: [gregarios] Ampersand in Form Submissions [In reply to] Can't Post

 You could use JavaScript to change the = and & characters to something else and then inside your script change them back...

Just an idea...

"So you want to be a cowboy
Well you know it's more than just a ride
Guess you got to know the real thing
If you want to know the other side
Ain't nobody riding shotgun
In this world tonight"


gregarios
stranger

Apr 7, 2002, 11:08 AM

Post #3 of 5 (585 views)
Re: [kidd] Ampersand in Form Submissions [In reply to] Can't Post

Good Idea, but I'm looking for something more reliable. I do have an idea that might work, but I need another answer to help it along.

I'm thinking of having one or both of two things happen. I could put an extra & in front of and at the end of each form field entry and then have it split on && instead of just &, and &= instead of just =. That would require redoing an incredible amount of html on several of my sites though, and some sites that aren't even mine! (I'm hosting the form cgi for those sites)

Another way would be to have the script only split it on an & that has no space directly after it, and on an = that has no space directly before it. I think that would eliminate at least 90% of the problem. However, I don't know how to accomplish this in the split function itself.

Can anyone show me some code that will accomplish this? :-)

Greg J Piper
[url=http://www.macpicks.com]MacPiCkS



yapp
User

Apr 8, 2002, 6:51 AM

Post #4 of 5 (582 views)
Re: [gregarios] Ampersand in Form Submissions [In reply to] Can't Post

SOrry if I completely miss your point here, but aren't & and = characters encoded to %HEX signs right away by your browser? (HTTP specs)

Using a default module like CGI.pm makes it even easier to parse CGI QUERY_STRING input:


Code
 use CGI(); 
my $cgi = new CGI();my $value = $cgi->param('keyname');



-- Hope it helps

Yet Another Perl Programmer

_________________________________
~~> [url=http://www.codingdomain.com]www.codingdomain.com <~~
More then 3500 X-Forum [url=http://www.codingdomain.com/cgi-perl/downloads/x-forum]Downloads! Cool


gregarios
stranger

Apr 8, 2002, 9:34 AM

Post #5 of 5 (578 views)
Re: [yapp] Ampersand in Form Submissions [In reply to] Can't Post

Doh!

Your right. I was converting it before spitting it. Thanks. ;-)

Greg J Piper
[url=http://www.macpicks.com]MacPiCkS


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives