View previous topic :: View next topic |
Author |
Message |
SLy CaT -
Joined: 20 Mar 2003 Posts: 19
|
Posted: Mon Mar 24, 2003 2:20 am Post subject: i have php setting problems? |
|
|
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 |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Mon Mar 24, 2003 10:11 pm Post subject: Re: i have php setting problems? |
|
|
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 |
|
|
SLy CaT -
Joined: 20 Mar 2003 Posts: 19
|
Posted: Mon Mar 24, 2003 11:52 pm Post subject: |
|
|
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 |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Tue Mar 25, 2003 2:36 pm Post subject: |
|
|
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 |
|
|
SLy CaT -
Joined: 20 Mar 2003 Posts: 19
|
Posted: Wed Mar 26, 2003 12:17 am Post subject: |
|
|
man, your great! cept you forgot to change $_REQUEST['page']; to $_REQUEST['p]; ;) lol. such a great help here :D |
|
Back to top |
|
|
|