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

In reply to CGI: Trouble changing/deleting a param by Reverend Phil

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.