Wrox Programmer Forums
|
BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5
This is the forum to discuss the Wrox book Beginning PHP4 by Wankyu Choi, Allan Kent, Chris Lea, Ganesh Prasad, Chris Ullman; ISBN: 9780764543647
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 26th, 2004, 02:36 AM
Registered User
 
Join Date: Aug 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default case switch

HEllo ...

I read in the book about the case and switch commands.

I made my index.php file like that:

Code:
<?php include('.include/headermain.php'); ?>
 
<?php

// main links

switch ($_GET['id']) {

case 'en_1':
include('.include/main.php');
break;
case 'en_2':
include('.include/contact.php');
break;
case 'en_3':
include('.include/skills.php');
break;
case 'en_4':
include('.include/about.php');
break;
case 'en_5':
include('.include/stats.php');
break;
// Mail link
case 'mail':
include('.include/sendeail.php');
break;
// End Mail link

default:
include('.include/main.php');
break;
}

// end main links

?>



<?php include('.include/footer.php'); ?>
You can see here I have my whole page devided in three sections.
Header, main and footer.
The URL will be generated in the browser as www.mypage/index.php?id=en_1 for the main part and www.mypage/index.php?id=en_2 for the contact part.

What I want?

Inside my main sections like main.php, skills.php, contact.php or about.php I want to add a link to another page in side my .include folder.

How can I get it to work so the browser generates an URL in the addressbar looking like this:
www.mypage/index.php?id=en_1&main=something
or from mine skills page:
www.mypage/index.php?id=en_3&skills=something.

Can I make it with variables ..
I do not know how to start?
Shall I make another switch php file?
Shall I somehow insert any code and how inside my index.php?

What is the best sollution doing it?

Thanx for all help!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Switch Case statements ermy78 Access VBA 3 October 20th, 2006 08:58 AM
Switch rajuru Beginning PHP 2 February 9th, 2005 11:24 AM
ASP switch(variable){} and case: JohnD Classic ASP Basics 3 September 18th, 2004 09:05 PM
search string either Upper case or lower case rylemer Beginning VB 6 3 March 24th, 2004 04:23 PM
Check Case in a Case-Insensitive DB nbryson SQL Language 1 January 23rd, 2004 07:36 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.