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

Did you know?Explore Trending and Topic pages for more stories like this.
$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

How to file_get_contents when login required?
Hello!

I am trying to read data from a page that you have to be logged into to view, I am try

simplexml_load_file and rss problem
Hi,

I have a problem parsing an rss feed using simplexml_load_file - this is strange as i hav

need help with php get
i have a option box that gets filled with dates, but how do i get once the option value has been cli

Need help with unexpected T-STRING error
I'm a newbie and I'm still learning PHP. However this error has me stumped. I've googled, searched t

Save cookie to DB
I'm working on a pixel tracking script for an incentive website and I need to use an ASP script to s

quick question
Hi ..

i have a question
how do i set a var so it displays via an echo
Code: $logo = '&a

in php, link returns to the line
When I add a link in a php page, the link word returns to the line (as a
would do)

Examp

Sending UDP Raw socket
I truly need help on this. I am trying to write a test program that simulate a network environment

SESSION CHECK WORKS "MOST" of the time... whats going on?
i have a sign in check thats included in every page that is a members only page which is basically a

BI in Upstream Production operations
Appreciate if you can assist in the following areas:
1) Examples of life before and after BI i

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