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

empty() error
Why does

Code: empty($USER_ID = $_SESSION["USER_ID"])
create this error...

getting a website's source code as a variable? How?
Hey guys, is there any way for me to get the source code of a website as a variable for me to work w

Forms Authentication and Refresh at Login page
Hello, When I try to press the Login button in my webapplication at my login.aspx page nothing h

Inserting 100x and 100y coordinates in mysql table - easy
Is there a way to insert this data into a mysql table named 'map' with the fields: 'x int 3' , 'y in

Users and Groups with PHP Classes
Hi,

I have setup what I hope to be a good working User class. Now I want to introduce group m

Filename like the user name
I am creating a form and storing the values in file. Could anyone please tell me how to write a code

Legal Issues for SAP ERP o ERP in general
Hi experts,

Can someone please help me finding some documentation about legal issues tha

Multithreading in Oracle (Java, SQLJ, Pro*C,??) on 10g
I am investigating how to run a Java stored procedure in multithread mode.
I know that if I chang

simple php table loop
Hi all,

I've the following code

<?php // Create category options

Curl timeout breaks script
So im having difficulties with skipping timeout error in curl
my script calls different functions

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