Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Website Design Forum


You are currently viewing our Website Design Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
[PHP] How to send variable to page address?
Old 02-16-2006, 11:17 AM [PHP] How to send variable to page address?
Junior Talker

Posts: 33
Trades: 0
How to create links like: something.php?id=something? Its very simple...
We create some page and in place where the content has to change you put this code:
Code:
<?php include("pages.php"); ?>
Now, to the pages.php you paste this first or this second:
Code:
<?php
switch ($_GET['id']) {
      case ("index"):
      include ("files/some_file1.php");
      break;

      case ("about"):
      include ("files/some_file2.php");
      break;

      case ("guestbook"):
      include ("files/some_file3.php");
      break;

      case ("other"):
      include ("files/some_file4.php");
      break;

      default:
      include ("some_file.php");
}
?>
OR

Code:
<?php
if($id=="index"){
include ("files/some_file1.php");
}
if($id=="about"){
include ("files/some_file2.php");
}
if($id=="guestbook"){
include ("files/some_file3.php");
}
if($id=="other"){
include ("files/some_file4.php");
}
if($id!="index" || $id!="about" || $id!="guestbook" || $id!="other"){
echo '<span>Error, no subpage like this!</span>';
}
?>
Wherever if you choose first or second yours links will look like this:
Code:
Index |  About | Guestbook | Other
Also you create needed files (php), which are included in script (about including here.

Created by m1chu
m1chu is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-16-2006, 12:05 PM
Junior Talker

Posts: 76
Trades: 0
Nice tut.. you could use the variable input to direct to pages insted of static, and have a 404 error for default.
IndianInk is offline
Reply With Quote
View Public Profile Visit IndianInk's homepage!
 
Old 02-16-2006, 12:22 PM
Junior Talker

Posts: 211
Trades: 0
thanks. im gonna use that to help my site
Quahog Crazy is offline
Reply With Quote
View Public Profile
 
Old 02-16-2006, 09:15 PM
Super Talker

Posts: 132
Trades: 0
thanx for nice tutorial plz bro can u post here very bignnertutorial of php for new php users?
__________________
Looking For Mods n Members


Please login or register to view this content. Registration is FREE
waqar is offline
Reply With Quote
View Public Profile
 
Old 02-17-2006, 05:41 AM
Junior Talker

Posts: 33
Trades: 0
If I have some free time I will try to create basic php tutorial especially for FreeDomain users :]
m1chu is offline
Reply With Quote
View Public Profile
 
Old 02-17-2006, 08:51 PM
Junior Talker

Posts: 58
Trades: 0
nice one, you can also use that with mysql db...
ozaidum is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to [PHP] How to send variable to page address?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.16385 seconds with 12 queries