Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: pass var in URL with spaces?

by arunhorne (Pilgrim)
on May 25, 2002 at 19:02 UTC ( [id://169291]=note: print w/replies, xml ) Need Help??


in reply to pass var in URL with spaces?

As an aside to your question I note that your parameters do not seem to be arbitrary. Can I suggest enumerating them, i.e. 0 for none, 1 for yes, 2 for no, 3 for yes and no.

The benefits of this are 2 fold... firstly you won't have to use URL encoding as it is guaranteed there are no spaces and secondly it will be harder for an individual to tamper with your URL as parameter meanings will be less verbose- how important this second point is depends on your view of security/purpose of the script.

If you create two subroutines: enum_param that takes a string (e.g. yes) and returns the number representing it and decode_param that reverses this. These will make it easy to use this process in more than one script.

Its only a thought and in many cases it might just be easier to URL encode. Hope it helps.

____________
Arun

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://169291]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-09-16 21:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The PerlMonks site front end has:





    Results (22 votes). Check out past polls.

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.