Web Development

  Homes arrow Web Development arrow Select Case
 Webmaster Tools
 
Base64 Encoding 
Browser Settings 
CSS Coder 
CSS Navigation Menu 
Datetime Converter 
DHTML Tooltip 
Dig Utility 
DNS Utility 
Dropdown Menu 
Fetch Content 
Fetch Header 
Floating Layer 
htaccess Generator 
HTML to PHP 
HTML Encoder 
HTML Entities 
IP Convert 
Meta Tags 
Password Encryption
 
Password Strength
 
Pattern Extractor 
Ping Utility 
Pop-Up Window 
Regex Extractor 
Regex Match 
Scrollbar Color 
Source Viewer 
Syntax Highlighting 
URL Encoding 
Web Safe Colors 
Forums Sitemap 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
WEB DEVELOPMENT

Select Case
By: Developer Shed
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating:  stars stars stars stars stars / 0
    2004-05-21

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     

    SEARCH DEV MECHANIC

    TOOLS YOU CAN USE

    advertisement


    by: Codefixer.com

    Select Case

    Select Case does a similar job to If..Then..Else..
    Below is an Example using a variable called Name
    Depending on whether Name equals Michael , Gavan , Fred or none of these names a different line of code is run.

    <%
    SELECT CASE Name

    Case “Michael”
    Response.write “Name is Michael”

    Case “Fred”
    Response.write “Name is Fred”

    Case “Gavan”
    Response.write “Name is Gavan”

    'It is possible that none of the case statements equal the value of variable Name
    'so in this scenario - use Case Else

    Case Else
    Response.write "The name is something else"

    END SELECT
    %>

    The above example applies to text. The example below applies to a number.

    <%
    SELECT CASE Number

    Case 1
    Response.write “Number is equal to 1”

    Case 2
    Response.write “Number is equal to 2”

    Case 3
    Response.write “Number is equal to 3”

    'It is possible that none of the case statements equal the value of variable Number
    'so in this scenario - use Case Else


    Case Else
    Response.write "The number is not equal to any of the values above "

    END SELECT
    %>

    Note that when using SELECT CASE you cannot use greater than and less than signs which you can with If...Then...ElseIf.

    (Read the second part of this tutorial that will introduce posting form variables and provide a slightly more complicated example

    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More Web Development Articles
    More By Developer Shed

       

    WEB DEVELOPMENT ARTICLES

    - On Page SEO for New Domains
    - Improve Your Site`s Speed
    - Safari Books Online Review
    - Creating an Estore From the Ground Up
    - Most Common SEO Mistakes Developers Make
    - Making the Most of Your Titles and Meta Desc...
    - Five Ways Using Flash Can Damage Your Site
    - A Web Designer`s Guide to Colors
    - Use Webstarts to Create a Free Site
    - More Than Just Looks. How Your Web Design C...
    - How to Design Content Pages
    - Mint Review
    - Make Your WordPress Website Look Professional
    - How to Create a Mobile Web Site
    - Meta Tags: Still Useful?

    Developer Shed Affiliates

     



    © 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap