On Jan 23, 2008 3:35 PM, Xiong, Bob <[EMAIL PROTECTED]> wrote:
> Hi Mike,
>
> Thanks for the investigation. I tested your flow and it worked in a way. I
> had
> to save away the id in a file in order to access it in the Update or
> Verify
> block. I had to use the id to update the record in the database.
>
> Bob,
Hi there. There is no need to use a file to save the id, to do that without
introducing other problems is more work than necessary.
One way to avoid using a file is to use a hidden field to store the id:
if (param('Action') eq 'OK') {
# fetch record from database using id ...
print start_form();
print "Phone number ", textfield('phone');
print submit('Action', 'Update');
print hidden(-name=>'current_id', -value=>param('id'));
print end_form();
} elsif (param('Action') eq 'Update') {
print start_form();
print "new field: Phone number ", textfield('phone');
my $new_phone_num = param('phone');
print p("DEBUG: phone => ($new_phone_num)");
print "Phone number ", textfield('phone');
print submit('Action', 'Verify');
print hidden(-name=>'current_id', -value=>param('id'));
print end_form();
} elsif (param('Action') eq 'Verify') {
print p("database will be updated");
my $updated_number = param('phone');
my $id = param('current_id');
print p("phone for ($id) updated to $updated_number");
}
TMTOWTDI applies, of course, you could also use cookies, but I would avoid
saving the id in a file.
Cheers,
Mike
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm