33 users online (0 members and 33 guests)  


  Results 1 to 12 of 12

Related

  1. Perl CGI !    Forum: CGI Perl Forum
    Replies: 4
  2. Replies: 1
  3. Replies: 1
  4. Replies: 0
  1. #1
    gdmay's Avatar
    New User

    Status
    Offline
    Join Date
    Oct 2002
    Posts
    6

    Using checkbox_group in OO perl

    Whenever I defined a checkbox group
    in perl I do the following:

    @array( 1, 2, 3, 4 , 5 );

    $cgi->checkbox_group ( -name => 'list',
    -values => \@array,
    -columns => 4,
    -rows => 2 );

    if checkboxs 1 3 5 are selected, when
    the submit is depressed then when getting the data from the form:

    $items_selected = param('list');


    $items_selected only contains 1.
    Where is 3 & 5?

    What I am doing wrong?

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Sorry my friend, it looks as if no-one here has enough knowledge of Perl to be able to help you
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  3. #3
    gdmay's Avatar
    New User

    Status
    Offline
    Join Date
    Oct 2002
    Posts
    6
    I figure this would be the problem...no one knows

    I investigated further and this appears to be a known issue
    with Perl and is on their TODO list. Just have to wait for
    the task to be done.

    I already developed a work around.

  4. #4
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Glad to hear it, gdmay
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  5. #5
    Zaire's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Mar 2001
    Location
    Hamburg, NY
    Posts
    312
    Maybe we should persuade him into PHP.. or even the dark side... .NET!

  6. #6
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Perl has its place. 1986, wasn't it?
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  7. #7
    Zaire's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Mar 2001
    Location
    Hamburg, NY
    Posts
    312
    Originally posted by QuietDean
    Perl has its place. 1986, wasn't it?
    LOL!

  8. #8
    Rat's Avatar
    New User

    Status
    Offline
    Join Date
    Feb 2005
    Posts
    1
    A quick work around:-

    my $items_selected;
    foreach my $p (param('list')) {
    $items_selected .= $p;
    }

    This should give you a string with all your selected params.
    You may want spaces between : $items_selected .= "$p ";
    You could also put them into an array with 'push @items_selected, $p;' in the loop instead.

  9. #9
    esharris's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2005
    Posts
    2
    Change $item_selected into @item_selected. You can't put an array value in a scalar variable.

    Don't hate . Participate .

  10. #10
    HTML's Avatar
    Administrator

    Status
    Offline
    Join Date
    Aug 2000
    Posts
    3,445

    Follow HTML On Twitter Add HTML on Facebook Add HTML on Google+ Add HTML on Linkedin Visit HTML's Youtube Channel
    The thread is 2 years old but your help is appreciated none the less. Certainly others with the same problem will read the thread and now have the needed help.

    thanks folks,

    Dave

  11. #11
    dav_y2k's Avatar
    New User

    Status
    Offline
    Join Date
    Jun 2006
    Posts
    1

    Re: Using checkbox_group in perl

    Hi all,
    I'm trying to delete specific rows from mysql database using checkboxes:

    I tried the following code but did not work:
    Table:
    Delete first_name last_name phone_number
    checkbox David McLeod 55555555

    <input type="checkbox" name="delete" value="1" />
    my $check = $t->param('delete') ;
    if ($check) {
    $dbh->do("delete from sample where first_name = '$check' ")
    }
    then print content of table. but it still returns all the contents of the table without deleting any rows.


    I noticed that when I use this:
    $dbh->do("delete from sample where first_name = 'David' "
    it deletes the row containing the name when I refresh the page without checking the checkbox.

    how do I pass the row parameter into the DBI delete statement.

    thanks.

  12. #12
    esharris's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2005
    Posts
    2

    Re: Using checkbox_group in perl

    My initial conjecture: the variable $check is set to 1, not "David".
    Now I'm going back to bed .



Tags for this Thread