Reduce redundancies in switch functions?


Posted on 16th Feb 2014 07:03 pm by admin

Hello all! I somewhat new to PHP, and was wondering if anyone could give some suggestions on a switch function to reduce redundancies, and to efficaciously implement the script on to other sites.
Code:
<?php

$choice=$_GET['act'];

switch($choice)
{
case 'about':
if(file_exists("includes/about.php"))
include("includes/about.php");
break;


case 'contact':
if(file_exists("includes/contact.php"))
include("includes/contact.php");
break;


default;
include("includes/about.php"); }

?>

No comments posted yet

Your Answer:

Login to answer
336 Like 12 Dislike
Previous forums Next forums
Other forums

What am I missing here? Help!
Hello all!. I can't seem to get this working right. Well - it renders right, but something is goin

Hi, explode and strstr.
Hi, I seem to be confused about the strstr function, eg. i have a string like:
"a.b.c.d.e.f&

Perplexing problem showing a .jpg
Please disregard..........I figured it out

"SEO" URLs
Hey, I'm wondering how to go about creating and using these types of URLs. I'm presuming it's PHP th

show random images
hey guys

can someone please suggest a way in which the following code can be edited so it onl

Embedding flash object in Else statement
This is my first major project in PHP and I'm having some trouble embedding a flash object in an Els

php or sql?
Sorry not sure if this is a sql problem or php the following code is supposed to delete data from th

Question handling xml data
Hello,

I have sucessfull followed this tutorial
http://www.phpfreaks.com/tutorial/handlin

quotes changing
hi all

in my content

opening quotes " changes to “

close qu

natcasesort works on one server but not on another
Hi

I have a problem that I was hoping that someone can help me with.

I'm trying to use

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash