Re: Passing two values with one form element?

by Stephen Johnston <pepe(at)gainsay.com>

 Date:  Wed, 05 Apr 2000 18:43:45 -0700
 To:  hwg-techniques(at)hwg.org
 References:  GIBRALTAR
  todo: View Thread, Original
Another option is to just pass the state and then on the backend pull the 
sales region out of a database table or array or some other storage method. 
This may give you better management options, particularly if any states 
change sales regions. Like if sales regions are associated with regional 
offices, where a new office may be created and take over some of the states 
that another office dealt with previously.

This could also be a nice introduction to database concepts if you have not 
dealt with that before. Using ASP and SQL server, this would probably only 
require an hour (or less) for someone who knows how to do it. And would not 
require a tremendous amount of study on your part to figure out how it is 
done. It would require one table and a query like: 'select region from 
sales_regions where state = "AL"' your table would look like this:

ID | state | region
1  | AK    | NorthWest
2  | AL    | SouthEast
3  | CA    | West

etc.

Hope That Helps-
Stephen Johnston

At 01:24 PM 4/5/2000 , you wrote:
>Seperate the two values in the drop down list with a character, such as ~ ( I
>like this one ) and then pass this to your server.
>
>Once the backend, explode this string, using your character ( ~ ) as a
>separtor, into arrays.  I do this quite often.
>
>---- other possible solution
>
>add let's say number to your state value (ie  IL2, CA4, etc)
>
>each number, being for in total, would stand for a different region.  Then
>using a expresssion evaluator function ( in PHP it is ereg ) check for the
>presence of this numeral.  Remove it from your string and treat according the
>region it belongs in.
>
>Any questions - by all means post them :-)
>
>
>
>Chuck Evans wrote:
>
> > Is there a way to have a form element, in this case a dropdown list, pass
> > two values (with two separate variables) back to the server?
> >
> > What I want to do is have a list of US States for the user to select one
> > from, and then pass back two values: State (equal to the state's name, such
> > as California) and a SalesRegion (equal to West, East, South, or Central).
> >
> > Or do I have to do this on the back end?
> >
> > And, if the answer is "You have to do it on the back end," are there any
> > free ASP scripts out there I can snag?
> >
> > Thanks.
> >
> > ---------------------------------------------------------
> > Chuck Evans
> > Web Marketing Manager
> > Captura Software, Inc.
> > (425) 424-1155
> > chucke(at)captura.com
> > www.captura.com
>
>--
>Jeremy Brown
>Director of Internet Technology Development
>Innovative Business Consultants
>http://www.ibc2001.com
>1-800-398-3007
>

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA