Current location: Hot Scripts Forums » Programming Languages » PHP » Switch function tutorial to have page.php?name=test


Switch function tutorial to have page.php?name=test

Reply
  #1 (permalink)  
Old 10-18-03, 02:24 AM
Miguel222 Miguel222 is offline
Newbie Coder
 
Join Date: Oct 2003
Location: Hesperia, California
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Post Switch function tutorial to have page.php?name=test

this is a tutorial on how to use this functions with php
good for those that want to have there site and not have like
site.com/chat.php
when u can have like index.php?page=Chat and so on..

ok lets start..
First we create a page like index.php or something ..

add this code..

<?php
// we start the switch u can change page to anything u want
switch ($page) {

case "chat":
echo "chat tesasdasdas
dasdasdasd";
// this will be the chat stuff add all the stuff here codem images etc,,

break;

case "contact":
echo "contact content here..";
/content here code etc.
break;

case "forums":
echo " this is forums page <a href=\"index.php\">go back</a>";

/forums page..
break;

default:
// the default page.. where it will be the main index
echo "Testing go <a href=\"index.php?page=chat\">to page chat </a> <a href=\"index.php?page=forums\">Forums</a>";
// code here etc..
break;

}
// we end this function..

?>

remember u can add other functions like chat();
and so on..
so more dynamic..

to call a page simply link like this

index.php?page=Chat and so on.. replace the chat with your own page name..

enjoy

Tutorial by Miguel http://www.laplebada.net
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Object Oriented Programming Stefan PHP 29 12-30-03 11:22 AM
More frickin' table help H-a-V-o-C_88 HTML/XHTML/XML 1 09-14-03 07:04 PM
Help trim code down TheLaughingBandit JavaScript 0 09-02-03 09:50 AM
File Management, sorry i keep changing, this is the last one! :) Arctic ASP 28 08-29-03 12:04 AM
edit php in Squirrelmail jrcortrightiii PHP 1 07-10-03 02:08 PM


All times are GMT -5. The time now is 07:11 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.