o2bwise has asked for the wisdom of the Perl Monks concerning the following question:
Hi there,
I am new to using the Mojolicious Perl mod and pretty new doing web design and I am positively stumped trying to pass parameters within a hyperlink. I would rather use the Mojolicious url_for command, but am fine specifying the hyperlink without.
Let's say there are variables $x and $y. Hyperlink text is value for $x.
One of my url_for attempts (although I see I am not encapsulating the href value in quotes:
<a href= <%= url_for("foo")%><%= x=$x&y=$y> %>$x</a>
And here is an attempt without url_for:
<%= <a href="http://foo.com/foo?x=$x&y=$y">%><%= $x %></a>
Actually, in one of my attempts (here just trying to pass one variable), I get to the url I want and I think the text of the url shows the correct syntax for passing a variable, but I do not see it. This is less generic, but:
<tr><td><a href="http://torstore01.omc.foo.com:443/device_list?id=<%= +$id %>"><%= $id %></a></td></tr>
Here is the url it goes to:
http://torstore01.omc.foo.com:443/device_list?id=568185
(Looks good to me!) And I have this asking for the parameter:
% use Data::Dumper; % use CGI; % my $cgi = new CGI; % my %input = $cgi->param(); % layout 'default'; % my $dir = '/home/tony/outage-management/testing'; % open (TEST,">$dir/device_list_test.txt"); % print TEST '%input: ', Dumper(%input);
And file device_list_test.txt contains
%input:
(The hash is empty.) Maybe I am passing the variable, but I am doing something wrong at the place where I try to fetch it?
For all I know, I am trying to do something in ways that cannot be done. Would sure appreciate a hand.
Signed,
{frazzled}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Passing Parameters via hyperlink
by davido (Cardinal) on Jun 27, 2013 at 00:01 UTC | |
by o2bwise (Scribe) on Jun 27, 2013 at 02:06 UTC | |
by Anonymous Monk on Jun 27, 2013 at 03:12 UTC | |
by o2bwise (Scribe) on Jun 27, 2013 at 19:20 UTC | |
by davido (Cardinal) on Jun 27, 2013 at 20:49 UTC | |
|
Re: Passing Parameters via hyperlink
by locked_user sundialsvc4 (Abbot) on Jun 26, 2013 at 23:37 UTC |