473,666 Members | 2,575 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Implementing "URL redirection" in PHP

63 New Member
hello,
i'm going to set up a small website in php. I suppose that it will use no database so I just need to write the main file only, say, the index.php. this site contains some pages which are similar in form but are different in content in the middle, or course. for example, I have the file index.php, then index.php?id=1 is for the first page, index.php?id=2 is for the second one and so on... like any other website, links are put on the left-menu... in the middle of each page there lies an include('conten t_page1.php') or something like that to make the content of each page.

is my description clear enough? I believe it will, though not much, differentiate itself from static HTML page :|

so, can anyone here tell me how to code it? thanks!
Oct 11 '07 #1
3 1438
jasone
66 New Member
Hi,

Firstly you it may be useful for you to have a PHP engine installed on your system to help with the testing, before you upload it to the server.

as far as tutorials go you cant go wrong with the website killerphp.com there are many video tutorials which taught me how to use php.

hope this helps

Jason
Oct 11 '07 #2
Lumpy
69 New Member
Yeah, that would work simple enough for a small website. I agree with Jasone though, install PHP locally so you can test it out before you go live.

Do a google search for Xampp, its an all in one package that makes it very simple to install apache and php and few others on your box. Probably the best way to go if your new to it all.

Other than that, when checking out the tutorials look into the 'switch' statement and the $_GET variable. You will pretty much use the $_GET[ID] to get your page id and a switch statement will help you to get the right content page loaded.

All in all, it would look something like this...

Expand|Select|Wrap|Line Numbers
  1.  
  2. $page = $_GET[id];
  3. switch($page) {
  4.  default:
  5.   include("home.php");
  6.   break;
  7.  case "1":
  8.   include("page1.php");
  9.   break;
  10.  case "2":
  11.   include("page2.php");
  12.   break;
  13.  
  14.  
Oct 12 '07 #3
pbmods
5,821 Recognized Expert Expert
Changed thread title to better describe the problem (did you know that threads whose titles do not follow the Posting Guidelines actually get FEWER responses?).
Oct 12 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
5286
by: NotGiven | last post by:
I changed my POST to GET and find appended to the url, the above string. Why and what can I do to NOT have them appended? Thanks.
7
5796
by: ryan.fairchild | last post by:
Ok I basically am creating a container for a bunch of other <div> tags. But I want to make four jpegs/gif/whatever that goes in each corner so they look rounded. I thought this is how I would do it but I could be wrong. body { background:#999 url("http://") no-repeat top left; background/* */:/**/url("http://") no-repeat top right; background: /**/url("http://") no-repeat top right;
2
1855
by: Souser | last post by:
I would like to learn how to double-jump a URL; in other words, I would like for a user to click on a link... which takes you to a site, and then upon landing, goes right away to another site(with no other click needed). Such as click on a link and it takes you to "www.dell.com" and then to "www.dell.com/laptops" immediately. I've seen many sites do this and would appreciate any help as to how this is accomplished. I have been told this is...
10
16568
by: Roland | last post by:
Hello, the example code is the following(the number in parentheses at the beginning are just for reference)(The complete HTML file is at the end of this article): (1)window.location = 'http://www.google.com'; (2)alert("I'm still here!"); (3)window.open("http://www.slashdot.com", "_blank");
4
2448
by: Martin | last post by:
Hi, From Page1.asp, I use "Server.transfer" to "REDIRECT" to another asp page (page2.asp), in page2.asp I use Request.ServerVariables("URL") and Request.ServerVariables("REFERER") to get the lastpage and the actual page, this method (or property) return incorrect values: "Page1.asp" and "" Why? Martin
2
497
by: Luke | last post by:
Hi I have the following code which is an ASP questionnaire using an Access database. (I am using access as I have no choice!). Basically there is an html form which submits the form to the page below and the code below submits the data to the DB and redirects the user. The code works locally on http://localhost or http://127.0.0.1 but when I upload it to a site (I have tried a few and they all error) it says "An error occurred on the...
4
2138
by: Lloyd Dupont | last post by:
I can't use Control.ResolveUrl because I need to write the conversion in a utility class. However I know the current context. How could I convert the URL to one usable by the user? -- I have taken a vow of poverty. If you want to really piss me off, send me money.
7
5328
by: Gabriella | last post by:
Hi, I would like to know how to find out which is the browser's "home" URL? This is so I'll be able to suggest "set as homepage" for my website, only for those who did not set it beforehand. I know there's a security issue with this, but is there some workaround it? Thanks,
4
2510
by: DonD | last post by:
I have a site that uses a bit of flash and I include a link for visitors to get flash if they don't have it. Unfortunately, the XHTML validator complains about the "get flash" url, even when using transitional. Does anyone know what I can do about this? I can't control Adobe's url and why would XHTML care? The "get flash" url is: http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&promoid=BIOW Thanks.
3
2314
by: Willy | last post by:
I have a website that uses querystrings on a certain page to show multiple contents. I have created mapped pages to hide the gory details of these querystrings. So instead of details.aspx?ID=kldjlkdjldsjlkds&cat=jjfjfj the client sees products.aspx I also use these "mapped" pages in my sitemap file. This site is multilingual so I have buttons on the page to switch languages.
0
8454
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8362
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8644
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7389
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6200
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5671
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4200
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2776
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2012
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.