So, the first problem is that hidden() doesn't have an argument called 'value'; it has 'default' instead. The second problem is that the default only applies if param('last_question') doesn't already have a value.CREATING A HIDDEN FIELD print $query->hidden(-name=>'hidden_name', -default=>['value1','value2'...]); -or- print $query->hidden('hidden_name','value1','value2'... +); hidden() produces a text field that can't be seen by the user. It is useful for passing state variable information from one invocation of the script to the next. Parameters: 1. The first argument is required and specifies the name of this field (-name). 2. The second argument is also required and specifies its value (-default). In the named parameter style of calling, you can provide a single value here or a reference to a whole list Fetch the value of a hidden field this way: $hidden_value = $query->param('hidden_name'); 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 you'll have to do it manually: $query->param('hidden_name','new','values','here');
Here's how to get the result you want; set param('last_question') to the desired value first, and then call hidden():
param('last_question', $last_question); print header, # ... hidden('last_question'), #... end_html;
In reply to Re: Checking Quiz Answers
by chipmunk
in thread Checking Quiz Answers
by dooberwah
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |