Solved

How do I parse a value in CGI

Posted on 1998-08-04
3
145 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
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…

730 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