Re: CGI help

new topic     » goto parent     » topic index » view thread      » older message » newer message
GeorgeWalters said...

Another question. Can you point me where to look. When I type '1/2 90 el' into a HTML imput field, I get 1%2F2 back in the environmental var instead of '1/2'. Apparently the slash has to be changed and I'm wondering if other chars are the same. Can someone point me to why this is and I can understand.

Certain characters have special meaning to HTML. For instance, &, =. Let's say you have a form that submits a post containing 2 fields, name and age. When submitting the form with no special characters, "name=John&age=30" would be sent to the web server, and then passed on to the web application. Now, what happens if in the name field you enter =Jim. If escaping did not take place, "name==Jim&age=30" would be sent to the web application, thus making it hard to parse. Many other characters have special meaning.

http://jeremy.cowgar.com/svn/webclay/trunk/webclay/cgi.e contains a function that takes either a QUERY_STRING or POST_DATA read from std in and returns a map of the values, automatically converting any escaped characters to their real (programmer usable) values. That function "process_data", the last function in the file. You can use it directly or just take bits and parts from it you need.

Jeremy

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu