PHP > ASP Select Case Statement

Associate
Joined
12 Aug 2004
Posts
1,009
Location
Glasgow, Scotland
Hi there,

I was wondering if anyone could give me a hand with converting a php select case statement into an asp one?

I normally use php for coding and have been using this for a while on various websites i've done:

Code:
<?php

	switch($page)
	{
		default:
			include("home.php");
			break;
			
		case aboutme:
			include("aboutme.php");
			break;
			
		case portfolio:
			include("portfolio.php");
			break;
			
		case links:
			include("links.php");
			break;
			
		case contact:
			include("contact.php");
			break;
			
		case thankyou:
			include("thankyou.php");
			break;
	}

?>

...but not to sure how to convert it into asp?
 
try this ? not 100% confident might execute all of the below :D


<%
dim page

page = variable

Select Case page
case "aboutme"
server.execute("aboutme.php")
case "portfolio"
server.execute("portfolio.php")
else
server.execute("thankyou.php")
end case

%>
 
Hi mate,

Thanks for replying, that definetly looks different from the way I was (unsuccessfully) trying it earlier so i'll give that a go :) :)

Thanks again,

Steven
 
akakjs said:
they don't fall through. Sucks I know.
Not sure why it sucks!

As for the syntax, I believe the else needs correcting, from memory.

Code:
<%
  select case page
	case "about"
	  server.execute "about.asp"
	case "portfolio"
	  server.execute "portfolio.asp"
	case else
	  server.execute "home.asp"
  end select
%>
You wouldn't want to include PHP files in ASP either :p
 
depends if there just plain html files renamed as php i spose but personally id agree :)

/me shrugs


spinneR~uk said:
Not sure why it sucks!

As for the syntax, I believe the else needs correcting, from memory.

Code:
<%
  select case page
	case "about"
	  server.execute "about.asp"
	case "portfolio"
	  server.execute "portfolio.asp"
	case else
	  server.execute "home.asp"
  end select
%>
You wouldn't want to include PHP files in ASP either :p
 
Code:
SELECT CASE strPage
	CASE "moo", "monkey", "chicken"
		stuff
	CASE "banana", "apple"
		other stuff
	CASE Else
		other other stuff
END SELECT

SELECT CASE intPage
	CASE 1, 2, 5
		stuff
	CASE 3, 6, 7, 8, 9
		other stuff
	CASE Else
		other other stuff
END SELECT

Doesn't that do the same though?
 
Back
Top Bottom