Page 1 of 1

Changing page content with Php $vars

Posted: Tue Apr 15, 2008 9:21 pm
by darkangel2001lv
I new to php, and have been all over web looking for codes that will switch body content of page without reloading page.
Below is php script that i am using index page load great however any link clicked get 404 error. i have check and all files are where they need to be. Please can someone help.



This is script in index.php (which i want to serve as the site template and only the content to change when a link is clicked)

Code: Select all

 
<?php
if ($_GET['ddl'])
if  (file_exists['./'$_GET['ddl'].'.html'))
include (*$_GET['ddl'].'.html');
else
include ('./404error.html');
else 
include ("./main.html");
?> 
 

the problem i think is with the links, this is the way all links are setup... is there some thing wrong here?

http://sitename.com/index.php?ddl=pagename

have also tried leaving out the sitename with same results.

Re: Changing page content with Php $vars

Posted: Wed Apr 16, 2008 3:11 am
by Phoenixheart
A dot is expected on line 4:

Code: Select all

if  (file_exists['./'$_GET['ddl'].'.html'))
should be

Code: Select all

if  (file_exists['./' . $_GET['ddl'] . '.html'))
also, what's with the asterisk on line 5 anyway?