Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Perl Programming Question
#3
You seem to be asking two different questions between the short and long versions. My response above answers the "short" version.

The long version would be, when you generate the page, store the array of comment ID numbers in your session with a unique key. How you do this would depend on how you are handling sessions. However, imagine you save this:

$SESSION['cb_f4jkd9sljfdk3'] = (32,54,765,345,234,763);

Where the numbers are comment IDs. Now, when you generate the page, you generate the comment checkboxes as "cb_comment_1", "cb_comment_2", "cb_comment_3", etc. You also include a hidden field, let's call it "cb_array" and it is set to the value 'f4jkd9sljfdk3'.

When you process the form:

$value = $input{'cb_array'};
@cbs = @{$SESSION['cb_' . $value]}(map { s/^.*_(\d+)$/$1/; } (grep /^cb_$value/, keys %input));

@cbs should now contain the values db comment ids. There might be a typo in that, but hopefully you get the idea.

- Shadow
Reply


Messages In This Thread
Perl Programming Question - by The UnDoug - 02-10-2006, 05:39 PM
Re: Perl Programming Question - by shadow - 02-10-2006, 06:08 PM
Re: Perl Programming Question - by shadow - 02-10-2006, 06:22 PM
Re: Perl Programming Question - by shadow - 02-10-2006, 06:23 PM
Re: Perl Programming Question - by The UnDoug - 02-10-2006, 06:40 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)