PHP pages won't work

Status
Not open for further replies.

jjpeacha

New Member
Messages
125
Reaction score
0
Points
0
Well I recently upgraded to version 2 of the PHP package, however my site (jc-studios.co.uk) still doesn't work. The first page shows correctly however when they click on a link (e.g. jc-studios.co.uk/?area=Portfolio) it still shows the homepage. I have used this design before and it has always worked so I dont understand why it is not working now. If you go to here: http://jc-studios.co.uk/pages/areaPortfolio.php you can see that the page to be included is there.

Can anybody help?

P.S here is a copy of my code!!

PHP:
	<?
		  if(isset($area)){
			  if (is_file("pages/area$area.php")){
				include("pages/area$area.php");
				}else{
				include("pages/nofile.php");
				}			
		  }else{
		  $pageid = 2;
		  include("pages/areaAbout.php");
		  }
		  ?>
 

Chris73

New Member
Messages
5,356
Reaction score
1
Points
0
Well scratch that as i have noticed they are named as you have shown. I will take a look.
 
Last edited:

jjpeacha

New Member
Messages
125
Reaction score
0
Points
0
Thanks!!

**UPDATE**

I now get this error:

Code:
Parse error: syntax error, unexpected $end in /home/jjpeacha/public_html/index.php on line 91
 
Last edited:

TechAsh

Retired
Messages
5,853
Reaction score
7
Points
38
I don't know much PHP but I think it's because it's always looking for the page "area$area.php" and not replacing $area with the correct content.

Try something like:
PHP:
<?PHP  
if(isset($_GET['area'])) {  
    if (is_file("pages/area".$_GET['area'].".php")) {  
        include("pages/area".$_GET['area'].".php");  
    }
else {  
    include("pages/nofile.php");  
    }              
}
else {  
    $pageid = 2;  
    include("pages/areaAbout.php");  
    }  
?>
Note: This may not work.
 
Last edited:

bugfinder

Retired
Messages
2,260
Reaction score
0
Points
0
I believe theres a simple explaination as to why the codes not working.

register_globals = off

get and post variables are not turned automatically into globals. You should check $_GET['area'] and use it as your values.
 

jjpeacha

New Member
Messages
125
Reaction score
0
Points
0
I believe theres a simple explaination as to why the codes not working.

register_globals = off

get and post variables are not turned automatically into globals. You should check $_GET['area'] and use it as your values.
How would I do that?

Also my site doesn't seem to want to load at all now?
 

Chris73

New Member
Messages
5,356
Reaction score
1
Points
0
Take this code and replace the other one with this one.

PHP:
<?  
          if(isset($_GET['area'])){  
              if (is_file("pages/area".$_GET['area'].".php")){  
                include("pages/area".$_GET['area'].".php");  
                }else{  
                include("pages/nofile.php");  
                }              
          }else{  
          $pageid = 2;  
          include("pages/areaAbout.php");  
          }  
          ?>
 
Last edited:

jjpeacha

New Member
Messages
125
Reaction score
0
Points
0
THANKS!! This has got it working!
Edit:
Closing Thread!
 
Last edited:
Status
Not open for further replies.
Top