i have php setting problems?

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
SLy CaT
-


Joined: 20 Mar 2003
Posts: 19

PostPosted: Mon Mar 24, 2003 2:20 am    Post subject: i have php setting problems? Reply with quote

Code:
<?php if ($page == "") { include "news.php"; } else { include "$page.php"; } ?>


for some reason, it wont load $page.php . it would only load news.php.

the url would be http://127.0.0.1/main.php?page=graphics to load the page graphics.php onto main.php right?

any solution to this problem? i believe it has something to do with my php settings... but i was hoping someone here would know the solution to this problem.
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Mon Mar 24, 2003 10:11 pm    Post subject: Re: i have php setting problems? Reply with quote

SLy CaT wrote:
Code:
<?php if ($page == "") { include "news.php"; } else { include "$page.php"; } ?>


for some reason, it wont load $page.php . it would only load news.php.

the url would be http://127.0.0.1/main.php?page=graphics to load the page graphics.php onto main.php right?

any solution to this problem? i believe it has something to do with my php settings... but i was hoping someone here would know the solution to this problem.

Use $_REQUEST['page'] instead of $page only. Read the PHP docs for more information about the new variables naming convention.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
SLy CaT
-


Joined: 20 Mar 2003
Posts: 19

PostPosted: Mon Mar 24, 2003 11:52 pm    Post subject: Reply with quote

sorry, i beleive it was basically the same problem i had last time. I'm new to php so i dont know much about configuring the stuff. thanks.

edit: so would it be.....

Code:
<?php if ($_REQUEST['page'] == "") { include "news.php"; } else { include "$_REQUEST['page'].php"; } ?>


? i get this error

Warning: main(.php) [function.main]: failed to create stream: No such file or directory in D:\server\web\main.php on line 78

Warning: main() [function.main]: Failed opening '.php' for inclusion (include_path='.;c:\php4\pear') in D:\server\web\main.php on line 78
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Tue Mar 25, 2003 2:36 pm    Post subject: Reply with quote

You code is bad because you cannot integrate $_REQUEST['page'] as is inside a string (between quotes).
So change your code to something simpler, for example:

Code:
<?php
$p=$_REQUEST['page'];
if ($p == "")
  { include "news.php"; }
else
  { include "$p.php"; }
?>

_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
SLy CaT
-


Joined: 20 Mar 2003
Posts: 19

PostPosted: Wed Mar 26, 2003 12:17 am    Post subject: Reply with quote

man, your great! cept you forgot to change $_REQUEST['page']; to $_REQUEST['p]; ;) lol. such a great help here :D
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group