mahirharoon
Dec 2 2007, 03:28 PM
this is my first topic(not post) i had posted it in another place CODE <?php
$variable = $_GET['id'];
switch($variable) {
default: include('home.php'); break; case "guestbook": include('guestbook.php'); break;
}
?> instructions: CODE case "guestbook": include([u]'guestbook.php'[/u]); break; = change - guestbook.php to the page url forum - change to your id (underlined) which will come in CODE index.php?id=[u]forum[/u] CODE $variable = $_GET['id']; -change id to what you want here (underlined) index.php? id=123
Reply
jlhaslip
Dec 2 2007, 08:13 PM
I am thinking that the Code should read as follows so that the default case gets handled after the check for "id". CODE <?php
$variable = $_GET['id'];
switch($variable) {
case "guestbook": include('guestbook.php'); break;
default: include('home.php'); break;
}
?> The Default case is a 'fall through' value. If there is not a 'break' for any other, correct, value, then the Default is applied. Correct me if I am wrong. Thanks.
Reply
mahirharoon
Dec 3 2007, 03:00 PM
hello but i think that the server first looks what first
Reply
hippiman
Dec 7 2007, 03:46 AM
I'm pretty sure 'default' is alway supposed to come last, because it has to check all the other values to know if it has the default. If you put the default first, it's not even going to check any of the cases. And it might be better to use the $_POST variable, instead of $_GET, because get shows in the URL. You can look it up, if you want. If you use get, you could do the same kind of thing with javascript, because I think you can get the variables from a method='get' with javascript, too. That way, it doesn't matter if you have PHP installed on the server, but it might matter what browser you're using.
Reply
Recent Queries:--
how to load a page in an iframe using php - 6.35 hr back. (1)
-
php paging - 61.19 hr back. (1)
Similar Topics
Keywords : php, page, switcher
- Naming Web Page Files
Which way you like- MyPage.html or my-page.html or my_page.html (5)
PHP Function To Add Previous and Next Page Feature
useful php function (0) CODE <?php function navigationbar($start_number = 0, $items_per_page = 50,
$count) { // Creates a navigation bar $current_page =
$_SERVER["PHP_SELF"]; if (($start_number < 0) ||
(! is_numeric($start_number))) { $start_number = 0; }
$navbar = ""; $prev_navbar = ""; $next_navbar =
""; if ($count > $items_per_page) { $nav_count = 0;
$pag....
Need Help To Increase The Page Rank Of Website!
(2) Hi everybody, I am dealing in online business and looking for some tips to increase the page rank of
my website. In this I need some helps from you people. Please suggest me some tips so that I can get
good traffic to my website and get more benefits. Your any suggestion will be highly appreciated.
Thanks in advance! ....
Adding Flash Music Player To Home/any Page
How-to (put any song you want!!!) (4) Want to put music on all pages (near the top)? Want any song you want? Well heres how! Place the
following IN PLACE of the tag (paste in while thats highlighted. The text in red you HAVE to
replace with the song url. The text in green is OPTIONAL (whether you want it to autostart or not.
Right now it doesnt, if you want it to replace no with yes.) Of course place this in Admin
Cp>>>Skinning and Styles>>>Board Wrappers>>>Header and Body QUOTE REPLACE THIS
WITH YOUR SONG URL &autoStart= no " /> src="http://www.podbean.com/podcast-au....
Page Load Error When Accessing Cpanel
(0) Not sure what the issue is. I cannot even load up any of the cpanel's to allow me to put in a
password. I have tried the link that is located in the Credit System 2.0 I have tried the links
with subdomain/cpanel I have tried the links with subdomain:2082 All 3 of these just give page
load errors. Please note : This isn't a "my password doesn't work" thread. This is a "I
can't even get cpanel to TRY to load" thread. Thanks in advance.....
How Do I Get Rid Of The Placeholder Page? [resolved]
(5) QUOTE Great Success ! Apache is working on your cPanelŽ and WHM™ Server If you can
see this page, then the people who manage this server have installed cPanel and WebHost Manager
(WHM) which use the Apache Web server software and the Apache Interface to OpenSSL (mod_ssl)
successfully. They now have to add content to this directory and replace this placeholder page, or
else point the server at their real content. ATTENTION! If you are seeing this page instead of
the site you expected, please contact the administrator of the site involved. (Try sending ....
How To Make An Item Scroll With You On The Page.
(9) ok im not sure where or how to really ask this... but you can find an example at
http://www.demonoid.com the ad that is on the right side scrolls with you basically to the bottom
of the page. I know they use an iframe but can you show me how that works or what makes it do that?
i tried to copy the source and css but it did not work.. any advice?....
What Is Your Home Or Start Page?
(14) I've had Yahoo! as my start page for many years. I'm wondering if there's a better
start page out there. I remember using Excite several years ago, but their home page now looks
outdated. Do you design your own start pages? If so, what's on it?....
Html Page Not Showing Up In Firefox
(1) Hi, I've tried to make a webpage in HTML using the frameset tag. Here is the code of the
webpage Sai's Makeshift Wiki And it's not displaying in Firefox. (I
mean is shows a blank page) It will show up in safari (I'm a mac user), all pages individually
work on firefox, just not the above page. Any ideas as to why? Thanks....
Multiple Page Titles
Multiple Page Titles (1) A really cool script. It allows you to put up to 6 page titles for one page and everytime you
refresh the page it alternates the title... It might help increase your Google Page rank I hope you
will like it. "Massive Respect" /smile.gif" style="vertical-align:middle" emoid=":)" border="0"
alt="smile.gif" /> /wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />
<script LANGUAGE="JavaScript"> var numb = 5 title_text = new Array(); title_text = "Your
Site Name here - Discription here"; title_text = "Your Site Name here - Discription ....
I Cant Log In To Cpanel
I get "Unable to connect" page (6) I am trying to get ot my cpannel but it won't let me connect. I am using Firefox, I cleaned out
my cashe and my cookies. I go ot http://mysite.trap17.com/cpanel and i get a page with this
message: QUOTE(errorpage) Unable to connect Firefox can't establish a connection to the
server at racuria.trap17.com:2082. * The site could be temporarily unavailable or too busy.
Try again in a few moments. * If you are unable to load any pages, check your
computer's network connection. * If your computer or network is protect....
Create Page?
How? (11) Hi, everyone! I need to create a script just within a page. Read the following story: I have
an account at one of file sharing hosts. I am tired of every time log in and tell others what I have
at it (files). If there is way to create a script that logs in me and just list the files i have
on this account from specified folder. If you know, let me know as usual.....
Admin Page
Tutorial Needed? (4) I need to look at a nice tutorial how do you create an admin access page with many functions as many
as possible.....
Uk Users: Beware Of Phorm The Spy Your Isp May Adopt
Phorm will spy on every page you visit and target adverts at you paid (3) Hello everyone, this applies mainly to UK users but overseas users might be interested too. I have
an RSS feed to the BBC website in firefox and i spied an article about a company named Phorm. You
may know Phorm by another name...121Media. The company that bought us spyware and adware that we
never wanted in the first place. Phorm is the next generation in remote spy/adware hosted at your
ISP. Let me explain. 3 ISPs in the UK are in talks with Phorm about introducing this system: Phorm
will intercept every web request made using your ISP (so that includes every webpage....
Web Page Layouts
using Cascading Style Sheets (1) Here are a set of three Web pages I wrote a long time back when I was first starting to develop
sites. The first one is a two columned page with a full length sidebar for navigation links. There
are two that are identical except the sidebar positions are reversed. Another is "one way" to create
a three column layout. And lastly, a 'framed' look on a page. These are not
'fancy', you will need to look into the code and colourize it to suit, maybe set a width and
centre it if you want, whatever... Please feel free to snag the source and develop the pages....
Create A Google Seach Result Page Embed Within Your Site Page.
(12) Create a google seach result page embed within your site page. It is easier to create
web page that embeded the google search result in it. The first step is to go to google apply an
account for the google ad-sense. After that login to you account and choose the create ad-seach
option. Most of time the google search box give all we have the great and powerfull seach ability.
But, have you think every time users get seach with it. They do redirected to another page that is
not within you site. It is easier to create web page that embeded the google sea....
Envizion's Front Page
(12) Ok, so I've done a really simple Front Page for my Game Development Team, ENVIZION. I was going
for clean and dark, so let me know if this works. If not, I think I'll go with something a
little brighter and a bit more intracate. http://www.envizion.trap17.com ....
Image Not Taking The Right Size In Web Page
An image is correct when designed, but not when put in a website (1) When trying to make a web page with a GIF image on it which runs a coloured bar along the top and a
coloured curve along the side, I come across the weird thing that, when I put the image on a web
site, it does not take in the whole top and does not run from top to bottom completely. The image is
made in Adobe Photoshop at a resolution of 1024X768 pixela and looks correct , ie. the horizontal
bit runs completely from left to righ and the vertical bit completely from topright to bottom right,
yet when put in to the web page, it shows with big margins left and right and to....
Error Code In Subscriptions Page
problems subscribing to topics (5) I'm seeing some weird warning message show up at the top of my page when I go into "my
controls," then load my topic subscriptions page. At the top of the page, the following code appears
several times: IPB WARNING in_array() : Wrong datatype for second argument (Line: 2711 of
/sources/action_public/usercp.php) I'm guessing maybe that has something to do with the fact
I'm having problems subscribing to my topics and posts? Thanks in advance for your help.....
Web Page Tree Menu: Style Sheet - Javascript
(5) I got bored and lazy working on the things that I should do... so I end up creating this tree menu
for anyone to use if they find it interesting. Well the idea is to create a tree menu in a webage.
Instead of those linear menu it would be better to add more dynamic to your webpage with a tree
menu. Others use image rollovers. As expecte the tree menu should behave like the one in Windows
Explorer. When you click a node depending on its state it will pull down or pull up its chlid nodes.
I have achieved by exploiting one style sheet property, display . Basically this s....
Scrolling Images?
How to Make an Image Scroll With the Page (5) I'm trying to make my homepage look a little fancier and I've got a nice background image,
but I want it to scroll with my page, like if you scroll down the image will still appear like it
does on the top of the page. Can someone tell me how to do this? I'm using Microsoft Frontpage
to edit it. I'm not sure what programming language this would be, probably CSS or Javascript,
but I can edit the page script with Notepad or something to make this work. Right now the page is
purely HTML, so whichever language this is, can somebody also give me the tags and ma....
Wap Source Code Viewer
Mobile/wap source code viewer page (4) This is a source code viewer that will workl on wap/mobile sites but you can easily convert it to
work on web im sure ;-) CODE <? header("Content-Type:
text/vnd.wap.wml"); echo '<?xml version="1.0"
encoding="utf-8"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <head><meta
http-equiv="Cache-Control" content="no-cache"
forua="true"/></head> <card title="s60.nerds.....
Refresh Page After Back Button Hit
(11) Hi. I have a page that is dynamically build through DOM manipulation. So, when I browse outside the
page, and then click back, those dynamically created DOM objects are gone. Since I am also using JSP
/ Servlet technology, I can rebuild this page easily, which I have done. Here is my dilemma. If
the user leaves the dynamic page, then clicks back on their browser, I need the page they are going
back to to refresh. I can't figure out how to do this. I've tried using the META tag, but it
won't do it. Help would be appreciated. Thanks. ....
Open Php Page From Another Server
If a server does not support php (7) If web server does not have .php support and I want to put a guestbook or something similar (no
database), and there is no support for other server side scripting, what should I do? I would not
like frames on my page, but - is there a possibility to put .php page from another site into layer
on my webpage at the no-php-site? Does layer support (or any other html command, excluding frames)
page including from another server? Also, does anybody have a solution for this any other way? How
to make a guestbook without php, perl, other scripting languages? Or, how control (r....
Cpanel Demo Page
for new applicants and guests (44) Hello TRAP17 members and dear guests, I have received permission to show demo version of cPanel
offered to all hosting members of TRAP17. This demonstration page will show what TRAP17 offers to
our hosting members, including what other services that are attached with cPanel. Please use this as
your guide when posting a question or simply take a tour before you can decide to host with us.
Click this link to see cPanel demo page From time to time I will work on to show a greater detail.
And the link may change in the future so please do not bookmark this page. I hope ....
Button To Print Current Web Page
(13) Hi, Does anyone know how to create a button that will printo out the current page. What I want to
do is have the user fill out a form (containing name, address, zip, etc). They will then click on a
"print" button and it will print out the form data. Any ideas? Thanks.....
Refresh Web Page
(6) Well this questioned wasnt answered in 2003 but hopefully somebody knows the answer, sorry if this
is a simple question but can i force the web browser to refresh the page after pressing the submit
button. Basically my cgi perl form copies a different jpeg with teh same name into my public_html
folder every time the form is submitted, therefore i have to click on the refresh button in IE to
see the different picture. I have tried Code: but it doesnt seem to work in IE6 ....
Toggle display in page script
(8) This is my very first script, before I knew what was out there. It works in IE 5 and up. Not sure
about netscape or mozilla. (I recently d/led mozilla and it's great for javascripts. Much less
typing.)
CODE <script language="javascript"> <!-- function
toggle(what){ if(document.all[what].style.display ==
"none"){ document.all[what].style.display = "block";
}else{ document.all[what].style.display = "none"; } }
//--> </sc....
Php Unique Hit Counter
Count page hits with php. (28) Hello all, Here is a neat and helpful PHP script that can count unique page views on your website.
First you need to open up a new page in your text editor and paste in this code. CODE <?php
$filename = "hits.txt"; $file = file($filename); $file =
array_unique($file); $hits = count($file); echo $hits; $fd
= fopen ($filename , "r"); $fstring = fread ($fd , filesize
($filename)); fclose($fd); $fd = fopen ($f....
Dreamweaver Or Front Page Or Other?
which's more professional & user-friendly (108) Dreamweaver is founded by Macromedia and Front page is founded by Microsoft. Both are used for
creating websites. Personally, I am using Dreamweaver MX, it is very user friendly and have great
support towards other Macromedia softwares like Flash and Fireworks. How about you, what kind of
software do you use to build your web?....
Looking for php, page, switcher
|
|
Searching Video's for php, page, switcher
|
advertisement
|
|