For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > September 2005 > changing action with appended key/value pairs in a POST









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author changing action with appended key/value pairs in a POST
Scott R. Godin

2005-08-24, 3:55 am

I have a multi-stage cgi I'm currently working on, and as I progress thru the
stages (the form uses POST not GET for reasons of data-size) I was hoping to be
able to simply add ?step=confirm or ?step=finish to the form action
( -action=>"$htmlform{action}?step=confirm", ... )

However it's not working, and I'm getting the distinct impression that when the
action is a POST, CGI.pm ignores anything WRT the uri request line...

Is this true?
Todd W

2005-08-30, 3:55 am


"Scott R. Godin" <nospam@webdragon.net> wrote in message
news:20050823190950.27586.qmail@lists.develooper.com...
> I have a multi-stage cgi I'm currently working on, and as I progress thru

the
> stages (the form uses POST not GET for reasons of data-size) I was hoping

to be
> able to simply add ?step=confirm or ?step=finish to the form action
> ( -action=>"$htmlform{action}?step=confirm", ... )
>
> However it's not working, and I'm getting the distinct impression that

when the
> action is a POST, CGI.pm ignores anything WRT the uri request line...
>
> Is this true?


You could refer to the CGI.pm docs, specifically the part about mixing POST
and URL parameters:

http://search.cpan.org/~lds/CGI.pm-..._URL_PARAMETERS

if ($q->url_param('step') eq 'confirm' ) {
...
}

or put the step parameter in a hidden field in the html form:

<input type="hidden" name="step" value="confirm" />

You may also want to check out CGI::Application, it makes quick work of what
you are trying to do.

Todd W.


Scott R. Godin

2005-09-10, 6:55 pm

Todd W wrote:
> "Scott R. Godin" <nospam@webdragon.net> wrote in message
> news:20050823190950.27586.qmail@lists.develooper.com...

[snip]
[snip][color=darkred]
> You could refer to the CGI.pm docs, specifically the part about mixing POST
> and URL parameters:
>
> http://search.cpan.org/~lds/CGI.pm-..._URL_PARAMETERS
>
> if ($q->url_param('step') eq 'confirm' ) {
> ...
> }

[snip]

ahh url_param() ... had quite forgotten about that one. I was trying to avoid
the use of 'hidden' fields if at all possible. This should do nicely. Thanks for
the tip.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com