Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 17th, 2007, 08:29 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

I reiterated from my previous post to place a Response.Write into the Case for MS and see if it executes. You focused on the Upper Case issue in your last post but did not say if you had placed the Response.Write into the Case.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old May 17th, 2007, 09:19 AM
Authorized User
 
Join Date: Apr 2007
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have tested the sState = ToUpper(sState). get an undefined error. Remember I am using ASP CLASSIC, not net!! asp classic uses UCASE for upper class. I tried UCASE, still does the same. only sends an email to what ever state is at the top of the list. I t will not send to other stastes at same time if there are more thaan one state...

 
Old May 17th, 2007, 09:24 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

You still havent answered my question.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old May 17th, 2007, 09:33 AM
Authorized User
 
Join Date: Apr 2007
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, I aded response.write myArray(i) & "<br>" and it only shows the first state in the list. So there must be something going on in the case code that is "dropping" the other states...

 
Old May 17th, 2007, 09:38 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Well, I don't know what to tell you then. I just tested this code and it works fine:

<%
Dim warehouse, MyArray
warehouse="NY,MS"
MyArray = Split(warehouse,",") 'the delimiter is the comma

For I = 0 to UBound(MyArray)
  sState = MyArray(I)
  SELECT CASE sState
    Case "NY"
       response.write "NY <BR>"
    Case "MS"
       response.write "MS <BR>"
   END SELECT
Next
%>

It writes out NY and MS to the screen just as it should.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old May 17th, 2007, 10:17 AM
Authorized User
 
Join Date: Apr 2007
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok dparsons. I sincerely apologize for my inexperience here. I am an avid web designer and html coder. Coding is an entirly other animal for me.

I have tested as you showed, and it works like a charm IF I hard code the states in there. What is baffling me is that why when I use warehouse = request.form("warehouse"), it only shows one state? If I place <%=warehouse%> on the page, it clearly shows all the states that appear in that field, but when I put back in warehouse = request.form("warehouse"), it apparently only pulls in one state? I thought the logic made sense, but I guess not. any thoughts?

 
Old May 17th, 2007, 10:22 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Hmm. Let me ask you this:

When you request the value from the form does the string look like this:
NY,MS

or does it look like this:
NY, MS

In the case of the latter, what would be happening is that your string is going to split into your array ALMOST as you expect.

ArrayElement[0] == "NY"
ArrayElement[1] == " MS" '<--Notice you have leading whitespace

So, in this case that is why the Case for MS (or any subsequet States) fails because "MS" <> " MS" hence it is not a correct case.

Use the Trim() Function to remove your Leading and trailing whitespace.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old May 17th, 2007, 01:01 PM
Authorized User
 
Join Date: Apr 2007
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Dparsons,
Thank you sooo much. It worked! I use LTrim. works like a charm, very time! I appreciate your help. You are truly knowledgable.
I will be sure to pick your brain in a month for now on another topic!

 
Old May 17th, 2007, 01:08 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

LOL. Glad you got it worked out. Ill see you in a month =P

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract part of String carrie09 Access 6 August 24th, 2007 10:04 AM
set password equal to variable fizzerchris SQL Server 2005 3 April 30th, 2007 01:45 AM
Getting Part of a String needelp Access VBA 4 September 19th, 2006 06:22 AM
Use a variable as a part of an XPath? NotesSensei XSLT 2 July 7th, 2004 04:10 AM
Conversion part of string to date MRvLuijpen Access 5 May 18th, 2004 02:31 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.