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

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

Dump with added_funcion cl_salv_table
Hi there, I'm having some troubles adding a self defined function to an ALV in fullscreen. The thing

'grab_files', multiple extension?
hey guys,

can anyone suggest a way to make to following line of code look for files with more

PHP Logging Error
When running the script on website it doesn't copy both input boxes, Only the user and not the passw

drop-down with sub-category appear
Hello,

i know how to build a simple dro-down list, im looking for a code when im gonna choose

Creating XML with php
I need to creat an XML with php and have successfully produced a valid output.
The problem I hav

PHP form authentication
Hi guys,

what am trying to achieve is this: Whenever a user tries to login to my website, an

PHP Code / Script To check weather the given email exists in a domain
Hi,

I want to implement the following in my web page

in sign up we will ask to enter u

Option box to change variable
Hello, i need help by making a script!

I need to write a file with option box, so a dropdown

PHP XML extraction text
I would like to extract an xml text and have that text directly echo(print) out on my web page. Her

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