Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > PHP Questions - be warned its been a while since i used it

PHP Questions - be warned its been a while since i used it
Thread Tools
Senior User
Join Date: Sep 2000
Location: Glasgow, Scotland UK
Status: Offline
Reply With Quote
Aug 25, 2004, 11:05 AM
 
before i begin its been a while since i was really using PHP and this may have been changed and passed me by.

often when i build a webpage with PHP i create the 'template' and load the content of a page with the include() function. i use the links to change a variable which is what the content loaded depends on. so for example to load a projects page i might use www.mywebsite.com/index.php?load=projects and then have a switch statement something like

swtich($load){
case "projects":
include(projects.inc);
break;
default:
inlcude("index.inc");
break;
}

however it seems that with the Apple installed Apache and PHP and indeed the PHP on my ISP's server that this is not valid for some reason. and the load variable value is always the default.

why is this? has something changed with PHP? please help - this used to work
"You can't waste a life hating people, because all they do is live their life, laughing, doing more evil."

-ALPHA ROBERTSON,whose daughter was one of four girls killed in the bombing of a Birmingham, Ala., church in 1963.
     
Grizzled Veteran
Join Date: Oct 2003
Status: Offline
Reply With Quote
Aug 25, 2004, 11:46 AM
 
Originally posted by ntsc:
why is this? has something changed with PHP? please help - this used to work
register globals are probably turned off. So you have to call post, get, session, etc variables by the superglobal. like so:

[php]swtich($_GET['load']) {
case "projects":
include("projects.inc");
break;

default:
include("index.inc");
break;
}[/php]

http://us3.php.net/variables.predefined
The only thing necessary for evil to flourish is for good men to do nothing
- Edmund Burke
     
ntsc  (op)
Senior User
Join Date: Sep 2000
Location: Glasgow, Scotland UK
Status: Offline
Reply With Quote
Aug 25, 2004, 01:31 PM
 
nice one thanks, is this a common occurrence now? what was wrong with register globals?
"You can't waste a life hating people, because all they do is live their life, laughing, doing more evil."

-ALPHA ROBERTSON,whose daughter was one of four girls killed in the bombing of a Birmingham, Ala., church in 1963.
     
Grizzled Veteran
Join Date: Oct 2003
Status: Offline
Reply With Quote
Aug 25, 2004, 02:09 PM
 
Originally posted by ntsc:
nice one thanks, is this a common occurrence now? what was wrong with register globals?
http://us3.php.net/manual/en/security.globals.php
The only thing necessary for evil to flourish is for good men to do nothing
- Edmund Burke
     
   
Thread Tools
Forum Links
Forum 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 On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:11 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2