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

Posts: 34
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
 
When You Register, These Ads Go Away!
Old 02-16-2006, 01:05 PM
Junior Talker

Posts: 81
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, 01:22 PM
Junior Talker

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

Posts: 131
thanx for nice tutorial plz bro can u post here very bignnertutorial of php for new php users?
waqar is offline
Reply With Quote
View Public Profile
 
Old 02-17-2006, 06:41 AM
Junior Talker

Posts: 34
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, 09:51 PM
Junior Talker

Posts: 58
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

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

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


Webmaster Resources Marketplace:
Software Development Company | Webhosting.UK.com | Text Link Brokers 


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

 


Page generated in 0.12183 seconds with 12 queries