gayu_justin has asked for the wisdom of the Perl Monks concerning the following question:
In my template file, i have written the code like below
[% IF cnt > 0 %] <tr><td colspan="2"> <h3 align="center">Have + you verified the Checklist ?</h3></td></tr> [%- SET i = 0; WHILE i < checklists.size; -%] <tr> <td> <input type="checkbox" name="chec +k_[% check_id.$i %]" value="1"/> </td> <td> [% checklists.$i %] </td> </tr> [%- SET i = i + 1; END -%]
And i want to take the name of the checklist in the cgi page, so that the value can be inserted into the database.since the name of the checklist has been given inside the array, i can't take that individually, so inthe cgi page, i have used the code like this :
It is showing the error in the line my $check_.$usr = $cgi->param("$chck_.$usr");if( $user->id){ my $usr = $user->id; my @userchecklist_id; my $check_ = "chck"; my $chck_ = "check"; my $quer = "SELECT checklist.id FROM group_management,User_group_manag +ement_mapping,profiles,checklist,checklist_group_mapping WHERE User_g +roup_management_mapping.userid = $usr and profiles.userid = User_gro +up_management_mapping.userid and group_management.id =User_group_mana +gement_mapping.groupid and checklist_group_mapping.checklist_id = che +cklist.id and checklist_group_mapping.group_id = group_management.id" +; my $query = $dbh -> prepare($quer); $query-> execute(); while(my($usrcheck_id) = $query->fetchrow_array()) { push (@userchecklist_id,$usrcheck_id); } foreach $usr( @userchecklist_id) { #print $usr . "\n"; #print $check_.$usr; my $check_.$usr = $cgi->param("$chck_.$usr"); print $chck_.$usr; } }
only if i can take the name of the checkbox, i can insert the value into the database. How can i achieve this.??
Note : @userchecklist_id contains values same as that % check_id.$i %, used in the template file.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: showing the error ,Can't modify concatenation (.) or string in scalar assignment
by marto (Cardinal) on Jul 18, 2013 at 09:32 UTC | |
|
Re: showing the error ,Can't modify concatenation (.) or string in scalar assignment
by hdb (Monsignor) on Jul 18, 2013 at 09:24 UTC | |
|
Re: showing the error ,Can't modify concatenation (.) or string in scalar assignment
by kcott (Archbishop) on Jul 18, 2013 at 10:03 UTC | |
by AnomalousMonk (Archbishop) on Jul 18, 2013 at 10:43 UTC | |
by kcott (Archbishop) on Jul 18, 2013 at 11:03 UTC | |
|
Re: showing the error ,Can't modify concatenation (.) or string in scalar assignment
by gayu_justin (Novice) on Jul 18, 2013 at 09:48 UTC | |
by DrHyde (Prior) on Jul 18, 2013 at 09:55 UTC |