Reverend Phil has asked for the wisdom of the Perl Monks concerning the following question:

Greetings, folks.
Here's today's little problem I'm having...
When entering one iteration of my script (one web page), if certain parameters are not set, I'm trying to give the user a message, and a button that will send them back to the last page with all the appropriate fields being passed. The param('action') is what I'm using to determine which function (ie: page) you are supposed to go to. When I get to the page, I'm dumping parameters to see how it's working, since I've been having problems deleting 'action'. delete('action') gave me a hassle, and param('action',undef) methinks was just appending an undef to the array param('action') rather then setting it. I'm using a hidden field to re-set 'action' in the new form.
The function code looks like this:
sub load_items { ($source, $po) = ( param('source'),param('po') ); if(!$source || !$po){ param(-name=>'action', -value=>''); print header(), start_html(-title=>"Title", -style=>{-code=>$got_no_style}, -BGCOLOR=>'tan'); print h1({class=>'Default'},'ERROR'), p({class=>'Error'},$mess_nosource); print start_multipart_form(), submit(-name=>'junk', -label=>'Return to Source/Ship Metho +d/PO'), hidden(-name=>'flags', -value=>$flags), hidden(-name=>'source', -value=>uc($source)), hidden(-name=>'po', -value=>$po), hidden(-name=>'file', -value=>param($file)), hidden(-name=>'action', -value=>'Accept These Customers'); end_form(),"</CENTER>"; debug_plop(); } else { #not hit right now } }
$mess_nosource is just the text on the screen. debug_plop just dumps my params. The output looks fine, but the dump looks like:
key source value zot key sm value 85 key po value key file value C:\temp\CGItemp4840001 key flags value 2345 key action value
My problem is, the line param(-name=>'action',-value=>'') successfully deletes that parameter, but my hidden() field with a name of 'action' is now not passing along the value.
Please enlighten me.
-rev

Replies are listed 'Best First'.
ZOT!: CGI: Trouble changing/deleting a param
by Reverend Phil (Pilgrim) on Jan 16, 2001 at 21:36 UTC
    ZOT!
    Once again, after looking at this extensively, then posting, I'm looking at it again and finding flaws in logic.
    Don't bother responding, or moderating this post onto the main boards, as I've got to clean things up before I determine if there's a real problem.
    Forgive me, I am only an egg.
    -rev