--- [EMAIL PROTECTED] wrote:
> Curtis,
> 
> What is the syntax for passing these values through the url?
> Greg

Greg,

Here's a little snippet borrowed from Randal Schwartz
(http://www.perlmonks.org/index.pl?node_id=80240):

    use URI; 
    use HTML::Entities; 
    my $uri = URI->new("http://base.address/cgi/foo.cgi";); 
    my ($value1, $value2, $value3) = qw/ foo bar baz /;
    $uri->query_form( 
        key1 => $value1, 
        key2 => $value2, 
        key3 => $value3, 
        key4 => 'oh my gosh; !');
    print '<a href="', encode_entities("$uri"), '">submit your query!</a>';

That will print the following URL:

<a
href="http://base.address/cgi/foo?key1=foo&amp;key2=bar&amp;key3=baz&amp;key4=oh+my+gawd%3B+!";>submit
your query!</a>

That URL is a bit outdated in that it encodes spaces with plusses (+) instead of %20.  
Also, name
value pairs should now be separated by semi-colons instead of ampersands, but from 
what I've seen,
that has been very slow to catch on.

Note that pairs are NOT separated by an ampersand, but are instead separated by &amp;. 
 When used
in HTML, that's actually part of the specification, but most (all?) browsers do error 
correcting
for that.  In other words, when used in HTML:

    name=Ovid&color=red     <- wrong
    name=Ovid&amp;color=red <- right

Cheers,
Curtis "Ovid" Poe

=====
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
"Ovid" on http://www.perlmonks.org/

__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to