Thread: PHP problem
View Single Post
Old Apr 11th, 2008, 1:25 PM   #1
zanatos
Newbie
 
Join Date: Dec 2007
Posts: 11
Rep Power: 0 zanatos is on a distinguished road
PHP problem

Hello I am trying to make a dynamic php template. However for some odd reason when i run my php program (with xampp) it loads the homepage fine, but my other pages are not working! when i click the other page it seems like it just loads the default template.php file (home page). I will post the code for the following: template.php, navbar.html (for the links), home.php (home page) and about.php( the second page that does not work)

Here is the code:
Template.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
	background-image: url(images/BG.gif);
}
-->
</style></head>

<body>

<table width="200" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>  
		<?php 
			include("Head.html");
		?>
    </td>
  </tr>
  <tr>
    <td>
		<?php 
			include("navbar.html");
	 	?>
    </td>
  </tr>
  <tr>
    <td>
    	<?php
			include("navwrapper.html");
		?>
    </td>
  </tr>
  <tr>
    <td>
	<?php
	
		if($_GET["file"]=="abt"){
			include("about.php");
		}else if($_GET["file"]=="serv"){
			include("services.php");
		}else{
		
		include("home.php");
		}
	?>    
	</td>
  </tr>
  <tr>
    <td>
    	<?php
			include("footer.html");
		?>
    </td>
  </tr>
</table
>
</body>
</html>

Code for the links (navbar.html)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<table width="200" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>
    	<img src="images/home.gif" width="83" height="82"
         onmouseover="this.src='images/home_roll.gif'"
         onmouseout="this.src='images/home.gif'"
         onmouseup="document.location='Template.php?'"/>
    </td>
 	<td>
    	<img src="images/about.gif" width="84" height="82"
         onmouseover="this.src='images/about_roll.gif'"
         onmouseout="this.src='images/about.gif'"
         onmouseup="document.location='Template.php?file=about'"/>
    </td>
    <td>
   		 <img src="images/services.gif" width="84" height="82"
         onmouseover="this.src='images/services_roll.gif'"
         onmouseout="this.src='images/services.gif'"
         onmouseup="document.location='Template.php?file=services'"/>
    </td>
    <td>
    	<img src="images/clients.gif" width="83" height="82"
         onmouseover="this.src='images/clients_roll.gif'"
         onmouseout="this.src='images/clients.gif'"/>
    </td>
    <td>  
    	 <img src="images/contact.gif" width="84" height="82"
         onmouseover="this.src='images/contact_roll.gif'"
         onmouseout="this.src='images/contact.gif'"/>
    </td>
    <td><img src="images/navwrapper.gif" width="381" height="82"/></td>
  </tr>
</table>
</body>
</html>

Code for home.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<script type="text/javascript">

function Intro(){
	window.alert("Welcome to Scale up")
	var na = prompt("What is your name?")
	window.alert("Hello " + na)
	confirm("Please click ok if you which to learn more about Scale up!")
}

</script>

</head>
<body onload="Intro()">

<table width="800" height="494" border="1" cellspacing="0" cellpadding="0">
  <tr>
    <td background="images/content.gif">
    <table border="1" cellspacing="0" cellpadding="0">
      <tr>
        <td>
        	<?php
				print "Welcome to Scale up!";	
			?>
        </td>
      </tr>
    </table></td>
  </tr>
</table>

</body>
</html>

Code for about.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

</head>

<body>
<table width="800" height="494" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td background="images/content.gif"></td>
    
    <table width="800" border="0" cellspacing="0" cellpadding="0">
     	 <tr>
        	<td>
        		<?php
					print "ABOUT PAGE";	
				?>
        	</td>
      	</tr>
    </table>
        
  </tr>
</table>


</body>
</html>

note: the background image loaded in home.php and about.php is where I would want my content to go.

Thank you and I would apreciate any help, as this problem is very frustrating lol keep in mind this is my first time doing php.
zanatos is offline   Reply With Quote