Solved

How do I parse a value in CGI

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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…

705 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