Solved

How do I parse a value in CGI

Posted on 1998-08-04
3
144 Views
Last Modified: 2013-12-25
 If I have a Drop-Down Combo box on a form ( such as Number of Employees ), with values like 1-15, 16-30, etc...
How do I parse the values into 2 seperate variables so I can check if it is within a range?

  Example code would be appreciated...
0
Comment
Question by:johnsand
3 Comments
 
LVL 28

Expert Comment

by:sybe
ID: 1831333
What language ? Perl, ASP, C++ ?
Most languages have a split function which works something like this.

NewVars = split(your_string,"-")
FirstVar = NewVars(0)
SecondVar = NewVars(1)

But it is easier to change the dropdown box:

<select>
<option value="1">1-15
<option value="2">16-30
etc
</select>

You can name the values the way you want it and in the responding cgi process the data accordingly.



0
 
LVL 4

Accepted Solution

by:
mitek earned 10 total points
ID: 1831334
One way to do that (for perl) would be:

($lval,$hval) = split /-/,$value;

if ($hval < 15) {

}
elsif ($hval < 30) {

}
else {

}

where $value is 1-15, or 16-30, or the like.
 
0
 
LVL 1

Author Comment

by:johnsand
ID: 1831335
That's exactly what I needed MITEK...  Thanks...
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Introduction:   Welcome to my first article ever. To begin with, the reason I write this article.  I participated in a question on Experts Exchange about the start command in Windows and there were some discussion about the usage. The discussio…
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 …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

839 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