Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Code for multiple select boxes in perl

Posted on 1998-02-17
3
Medium Priority
?
288 Views
Last Modified: 2013-12-25
what is the section of code for obtaining the data from a multiple select box.  I can get it to display the first value, but I need it to show all of the values selected.  The script is in perl.
0
Comment
Question by:7thwave
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 5

Expert Comment

by:icd
ID: 1831999
You don't state the script or module you are using to obtain the cgi variables. It is likely however that the script has put the multi-part data into a single variable (such as $in{myvar}) and separated them by the '\0' character. If this is the case then you can separate them with the following code.

@params = split ("\0", $in{myvar});

If this is not the case then let me know what cgi library/module you are using.

0
 
LVL 84

Expert Comment

by:ozo
ID: 1832000
I'd recommend CGI.pm:

#!/usr/bin/perl
use CGI qw(:standard);
print header;
print start_html('A Simple Example'),
      h1('A Simple Example'),
      start_form,
      checkbox_group(-name=>'words',
                     -values=>['eenie','meenie','minie','moe'],
                     -defaults=>['eenie','minie']),
      p,
      submit,
      end_form,
      hr;

if( param() ){
    print
        "The keywords are: ",em(join(", ",param('words'))),
        hr;
}
print a({href=>'http://www-genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html'},'Go to the documentation');

0
 
LVL 2

Accepted Solution

by:
yyyannag earned 100 total points
ID: 1832001
Try this :


$input{'input name'} =~ s/\0/, /g;

Then use the Print<<"EOD" as usual.
0

Featured Post

Cloud Training Guides

FREE GUIDES: In-depth and hand-crafted Linux, AWS, OpenStack, DevOps, Azure, and Cloud training guides created by Linux Academy instructors and the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
This article will show, step by step, how to integrate R code into a R Sweave document
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question