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

Force download script not handling files with spaces properly
I have a regular old php force download script, uses this code:

Code: header("Cache-Cont

Dynamic Data + Sql Server 2005 Enterprise?
Hi! I have just started to learn ASP.NET, and it looks like it is quite a lot to learn. Im not reall

Query failed issue with php script but works fine in mssql manager!
hi i have the script below which copies data from one table to another but will only insert new data

multipart emiail forms
Hi All,

I am new to the boards and I've been working on a form (which is rather massive, imo

Parse Error with doctype
I'm getting a parse error with this simple code. I don't get it. It worked one time then when I relo

Asset Transfer from One plant to another within same company code
Hi,

Please advise how to transfer one asset from one plant to another plant within same c

How to add functionality to a simple php calender?
Hello everyone,

I have just finished creating a simple php calander. Can someone point

GET vs SUBMIT Button to show sections on one index.php page?
Just curious if one of these ways is better (i.e. more efficient) than the other.

I have a

Adding delete feature to my forum
Hello I am currently trying to add a delete feature to my forum. I believe I have everything built r

show random images
hey guys

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

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