xaphod has asked for the wisdom of the Perl Monks concerning the following question:
I'm writing a mod_perl handler. Nothing exciting, just learning the art and having fun. Only I've hit a little snag-ette...
I have a form like this:
I can get the results of this form easilly using Apache::Request.<form action="" method="post"> <input type="hidden" name="form" value="login"> name <input type="text" name="name"> password <input type="text" name="pass"> </form>
Which gives me:print "\nParameters:\n"; my $apr = Apache::Request->new($r); my @params = $apr->param; if (@params) { for my $param (@params) { print " $param: ", $apr->param($param), "\n"; } } else { print "NO PARAMETERS\n"; }
Which is fine. However, if the URL this is posted to has a GET query string such as http://www.mine.org/handler?name=foo then I get this:Parameters: form: login name: username pass: password
Parameters: name: foousername ## ---- an array form: login pass: password
So, obviously, Apache::Request does not differentiate between GET and POST data. However, I'd like to keep the two seperate. So my question to my fellow monks.... What would be the best way to stop my GET data and my POST data getting mixed up?
I can think of a couple of ways to do it. But I'd like to find a simple, efficient, and elegant solution.
--
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Preventing GET and POST from getting mixed-up
by liz (Monsignor) on Aug 19, 2003 at 08:20 UTC | |
by esh (Pilgrim) on Aug 19, 2003 at 08:34 UTC | |
by liz (Monsignor) on Aug 19, 2003 at 08:41 UTC | |
by xaphod (Monk) on Aug 21, 2003 at 09:31 UTC | |
by xaphod (Monk) on Aug 19, 2003 at 08:39 UTC | |
|
Re: Preventing GET and POST from getting mixed-up
by Juerd (Abbot) on Aug 19, 2003 at 08:36 UTC | |
|
Re: Preventing GET and POST from getting mixed-up
by derby (Abbot) on Aug 19, 2003 at 17:13 UTC | |
|
Re: Preventing GET and POST from getting mixed-up
by cfreak (Chaplain) on Aug 19, 2003 at 13:19 UTC | |
by xaphod (Monk) on Aug 19, 2003 at 14:48 UTC |