Connecting Tech Pros Worldwide Forums | Help | Site Map

How do I pass forward a file or file name from a redirect page

Newbie
 
Join Date: Nov 2007
Posts: 1
#1: Nov 12 '07
I have a main Php page with 75% constant contents. I want to change the other 25% depending on what page calls the main page.
Example
www.example.com/a.html
www.example.com/b.html
www.example.com/c.html

The above pages use an html redirect code

www.example/x/y/z/mainpage.php

Pages a, b, and c are redirect pages to mainpage.php
How can I how can I open storya.txt when someone clicks on ~.com/a in the mainpage.php or storyb.txt if they click on ~ .com/b ?

Member
 
Join Date: Oct 2007
Location: Wisconsin, US
Posts: 70
#2: Nov 12 '07

re: How do I pass forward a file or file name from a redirect page


An easy way to do this would be to put a variable into the url. Redirect to something like www.domain.com/whatever?page=a and then in the first few lines of the target page, put in a few lines of php code that will load the right content.

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. if (isset($_GET['page'])) {
  3.  
  4. ///code to get right content
  5.  
  6. }
  7.  
Simple and effective...good luck!
Reply