When I run this code with the `foo' parameter defined, I get bad results. For example:#!/usr/bin/perl use warnings; use strict; use CGI qw/ :standard /; print hidden( -name => "foo", -default => "bar", ), "\n";
The value of the hidden input changes based on the pre-existing values. I see that one can use hidden() to retrieve values but I simply want to define a new one at this point. The `hidden ( $name, $value )' usage functions in the same way.> ./hidden.pl # the code above <input type="hidden" name="foo" value="bar" /> > ./hidden.pl foo=123 <input type="hidden" name="foo" value="123" />
Destroying CGI parameters in order to insert hidden fields does not seem reasonable to me. There must be a bettery way. Is there a way to overcome this problem simply? And is there some reasoning behind the way things currently are?Note, that just like all the other form elements, the value of a hidden field is "sticky". If you want to replace a hidden field with some other values after the script has been called once youll have to do it manually: $query->param(hidden_name,new,values,here);
In reply to Hidden fields using CGI by narse
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |