![]() |
|
#1
|
|||
|
|||
URL problem in simple Content Management SystemHi to all Ph.P experts,
I am stuck with a problem pertaining to URL and PHP variables. ========== The Problem. ========== I am trying to display dynamic content by letting the PHP parser parse PHP variables that point to another PHP file. I haven't even dived into creating a more complete page. I just want to verify if the textbook examples I have learnt works. To my dismay, they don't quite work. My main page is index.php. I am trying to click on a link indicated by <a href=test.php?page=testC>Test</a> to load testC.php. By default, testB.php works when index.php was loaded but when trying to click on the link embedded as a List Item, nothing happens. I want it to display testC.php but it just wouldn't. Appreciate any help! =========== index.php file. =========== PHP Code:
=========== testB.php file. =========== testB contents. =========== testC.php file. =========== testC contents. Last edited by LuciWiz : 15-Jul-2005 at 06:04.
Reason: Please insert your Php code between [php] & [/php] tags
|
|
#2
|
|||
|
|||
Errataoops... I'm sorry the "test.php" in
<a href=test.php?page=testC>Test</a> should be <a href=index.php?page=testC>Test</a> |
|
#3
|
||||
|
||||
|
Hello dave,
Have you figured this out already? Quote:
Anyway, a much "safer" solution can be found here: http://www.gidforums.com/showthread.php?p=2085... it's an old thread but still relevant. __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#4
|
|||
|
|||
|
Hi JDL,
Thanks for the link. The problem as I mentioned in my original post is that without using $_GET, to display dynamic content simply by using the format <a href=index.php?page=testC>Test</a> wouldn't work as $page wouldn't be populated as "testC" when index.php reloads upon clicking the above link. I don't know why it wouldn't work as I followed a text book example for that. Then I read somewhere else that it could be because the "register_globals" directive in php.ini was not set to "on". So curious I was, I went to change it from "off" to "on" but the problem still persists. However, the link you had provided suggesting the use of $_GET works perfectly fine. Now my CMS can display dynamic content according to what I put after "page=", i.e. I reckon that $page gets populated correctly as index.php reloads. Now everything works! Just that I cannot somehow accept the fact that a text book example failed to work. Not sure if it is due to some things I didn't yet turn on or what. Anyway thanks for your great help! It's been solved. If you know the answer to the initial problem, I would love to hear it. Once again thanks! Dave |
|
#5
|
||||
|
||||
|
The book you're using, it may not be something that was published recently.
As you are aware now, the default setting (in php.ini) for register_globals is now OFF; since version 4.2.0 actually, according to the manual. If the book was published before that, then the example was valid at the time but is no longer so. __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#6
|
|||
|
|||
Thanks.Thanks JdS!
Quote:
|
Recent GIDBlog
Last Week of IA Training by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| c simple question problem with switch case | if13121 | C Programming Language | 2 | 25-Oct-2004 01:06 |
| how do you seo a content management system | JUNK KED | Search Engine Optimization Forum | 4 | 07-Jun-2004 22:50 |
| RE: A simple update and } problem | Dagma20 | MySQL / PHP Forum | 3 | 27-Mar-2004 16:37 |
| Content Management HELP! | JamesRxx555 | Web Design Forum | 7 | 06-Jul-2003 22:48 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The