Hello,
I created a script for a webpage to pull html from file and whenever someone clicks a link it goes to the URL?page=pagename.html and the script reads the content of that html file. here is the code:
<?php
//get ?page= value
$_get['page']
//check if the value is set
if (isset($page)) {
//if so do nothing
}else{
//if not then set to home.html
$page = "home.html";
}
//open the html file
$whattoread = fopen($page, "r");
//grab contents
$file_contents = fread($whattoread, filesize($page));
//close file
fclose($whattoread);
//display content
echo "$file_contents";
?>
All I want this to do is if there is no variable specified (?page= does not exist) then grab the contents of home.html, but if it is specified then display the contents of the specified value (i.e.- if it is URL?page=about.html then it displays the contents of about.html).
Simple I thought, but when I run it I get this error:
Parse error: syntax error, unexpected T_IF in /home2/altcomp/public_html/index1.php
Help is greatly appreciated.
Thanks.