Jump to content

PHP Include not working


xf220

Recommended Posts

The website is http://www.grlistingservices.com

 

The code block is as follows:

 

<?php
if (!isset($id))
{
include 'home.php';
}
else
{
include "$id.php";
}
?>

 

All files are in the same directory, I am running php5.x on a windows server with GoDaddy.

This website used to work at my hold host, I just switched it today.

 

you tried using the double quote?

 

"home.php"

 

also you have to concatenate the variable with .php

 

include "".$id.".php"; that may work..., i havent tried it...

 

or even

include $id.".php";

Link to comment
Share on other sites

I apologize, I had different code running from trying to solve my problem, I put the original code back in.

Again so you do not have to scroll up.

<?php
if (!isset($id))
{
include 'home.php';
}
else
{
include "$id.php";
}
?>

 

This code includes home.php correctly. When you click a link, it doesnt change the page included.

Link to comment
Share on other sites

index.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<title>GRListing Services-</title>

<meta name="keywords" content="GRListing Services, Real Estate Listings, Real Estate, WNY, Buffalo, Property Staging ">

<meta name="description" content="Property/real estate staging and preparation in Western NY.">

<link rel=stylesheet href="styles.css" type="text/css" />

</head>

<body>

<table width="864" align="center" cellpadding="0" cellspacing="0" border="0" class="main">

<tr>

		<td class="green" align="right">GRListing Services - Williamsville, New York 14221</td>

</tr>

<tr cellpadding="0">

	<td cellpadding="0">

	<img src="images/topheader.png" />

	</td>

</tr>

<tr>

<!-- ==================== LINKS =========================== -->

	<td class="green" align="center">

<table width="100%" cellspacing="0" cellpadding="0" width="center" border="0">

<tr>

	<td align="center"><a href="index.php?id=home">Home</a> </td>
	<td align="center"><a href="index.php?id=services">Services</a></td>
	<td align="center"><a href="index.php?id=contact">Contact</a></td>

</tr>

</table>

	</td>

</tr>

<tr>

	<td> <img src="images/header.png" /> </td>	

</tr>

<tr>

	<td>


<?php
if (!isset($id))
{
include 'home.php';
}
else
{
include "$id.php";
}
?>

	</td>

</tr>

<tr>



<td class="green">
&#169 2010 GRListing Services. All rights reserved.
</td>

</tr>

</table>

</body>

</html>

 

home.php

<table width="100%" cellpadding="5" cellspacing="0" align="center" border="0">

<tr>

<td colspan="2" align="center">

<h2>Let us help you improve the quality of your property!</h2>

</td>

</tr>

<tr>

<td>

<h3>How can we help?</h3>

GRListing Services is committed to helping Western New York sell properties by:

<ul>
<li>New Listing Preperation</li>
<li>Property Clean Up</li>
<li>Property Checks</li>
<li>General Maintainence</li>
<li>Sign Placement and Removal</li>
</ul>

</td>

<td>

<img src="images/forsale.png" align="right" />

</td>

</tr>

<tr>

<td colspan="2">

<center><h2><a href="index.php?id=contact"/> Get started today! </a></h2></center>

<p>GRListing Services is here to help any one sell a property for more! We specialize in prepping properties
for sale so that the seller can earn the most for their property! Not only does GRListing Services advise homeowners and real 
estate agents of how to make the most of a sale, we do the work. The team at GRListing Services is dedicated and ready to help you; 
<a href="index.php?id=contact">contact us</a> today to learn more about what GRListing Services can do for you.</p>

</td>

</tr>

</table>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.